-
Notifications
You must be signed in to change notification settings - Fork 457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom chart colors support within existing colors
prop
#843
feat: custom chart colors support within existing colors
prop
#843
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This PR is what open-source maintainers dream of🫶 Will go to bed now and review it tomorrow! |
Hah! Awesome, thanks @severinlandolt - appreciated 🙏 |
5752d25
into
tremorlabs:beta-customcolors
🎉 This PR is included in version 3.12.0-beta-customcolors.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi @adamhenson, I just released a new beta (beta-customcolors) and testing it on our website. Two small questions:
Update: Adding |
Thanks @severinlandolt! And thanks for testing. Yes, correct, we don't need In the meantime, I'll open a branch against |
Would you be able to provide the full error @severinlandolt? |
Sure @adamhenson,
Using I try to create a small repo to replicate the issue in the meantime |
Also, with that said this could be a breaking change in types if I'm wondering if we should do something like this and replace all occurrences of - export type Color = (typeof colorValues)[number];
+ export type Color = (typeof colorValues)[number] | string; EDIT: You can disregard the above - was just thinking. And I still don't think this should be a breaking change. The error is a little confusing because it says |
Hey @adamhenson, I added you as an outside collaborator to this repo so feel free to directly push to https://github.com/tremorlabs/tremor/tree/beta-customcolors Working on the reproduction now (ps: other repos of mine work fine) |
Great, thanks @severinlandolt! |
Another thought I had is maybe the build tool from the repro website doesn't like my type casting in this one. export const getIsBaseColor = (color: Color | string) => colorValues.includes(color as Color); But will wait to look at the repro. EDIT: that doesn't really make sense either if it's built already. I'll just hold my horses 🏇 |
Alright, sent you another invitation 📨 dev works, build not Culprit: |
Perfect, thanks @severinlandolt 👀 |
@adamhenson Feel free to make as many beta releases of https://github.com/tremorlabs/tremor/tree/beta-customcolors as you wish. Just prefix your commit with |
Oh awesome, thanks @severinlandolt! I might be able to get away with local testing via |
True, in the previous version the type in question was not exported! |
@severinlandolt, yep - |
Phew, thanks for all the help here @severinlandolt. And let me know if I can do anything else. |
No, I have to thank you! I will test the new beta in my repos asap🚀 Crazy what one single export can cause in side effects |
Hah! Yep, the main entrypoint of the package exports everything from Line 2 in 1744e4d
And the repro project expects all those imports to be components 🤷 (or something like that... maybe all non-type exports) // wildcards are a little dangerous for this reason
import * as tremor from "@tremor/react";
// ...
<MDXRemote
{...source}
components={{
...getRenderersByContext(context),
// this is where i think the assumption is that all imports are components
...tremor,
}}
/> I get why this is like this... I mean you wouldn't want to have to update the imports explicitly anytime a component is added. |
* feat: custom chart colors support within existing `colors` `prop` (#843) --------- Co-authored-by: Adam <adamhenson1979@gmail.com>
* feat: Add tooltip to switch component (#819) * chore: tracker facelift (#839) * feat: Custom Chart Color (#845) * feat: custom chart colors support within existing `colors` `prop` (#843) * Update tailwind.config.js * Update pull_request_template.md --------- Co-authored-by: motinados <69296148+motinados@users.noreply.github.com> Co-authored-by: Maxime BAUCHET <maxime.bauchet@insystem.fr> Co-authored-by: Adam <adamhenson1979@gmail.com> Co-authored-by: Rajdip Bhattacharya <agentR47@gmail.com> Co-authored-by: christopherkindl <53372002+christopherkindl@users.noreply.github.com>
Description
This change is refactor of #836 to provide support for custom colors, but instead of the additive
customChartColors
prop
- this ports functionality to the existingcolors
prop
.With this change, the
colors
prop
can accept custom colors or tremor base colors ((Color | string)[]
).customChartColors
is removed in this change.Example Usage
Example
safelist
needed in Tailwind config to support the above implementation:Updated Components
AreaChart
BarChart
DonutChart
LineChart
ScatterChart
SparkAreaChart
SparkBarChart
SparkLineChart
Related issues and PRs
What kind of change does this PR introduce?
Although this change updates the existing
colors
prop
, the functionality is additive and doesn't break existing behavior.Does this PR introduce a breaking change? (check one)
How has This been tested?
Storybook stories have been added for all components demonstrating new support of custom colors in the
colors
prop
.The PR fulfills these requirements:
main
branch