-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
docs: apply custom theme from a Gist #4345
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
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui/5Y4tjHvFRA6bC82sjPSkMvw4MrYA |
This pull request introduces 1 alert when merging 9b53014 into 33b1919 - view on LGTM.com new alerts:
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9b53014:
|
Hi @tomchentw! You're really crushing it with your PRs related to this functionality and I really love the work you've been doing. After @segunadebayo and I discussed this yesterday on our Maintaining Chakra UI livestream, we feel like this functionality would make more sense as its own standalone app rather than being embedded in the docs. In my view, this is for a few reasons:
Would you be interested in working on a project to build a fully-fledged theme explorer type of app instead? |
Totally agree with @with-heart, this should be a standalone app, perhaps you can call it "Theme Explorer". Kindly consider this and let us know what you think (here or via Discord). In the meantime, we'll close this |
Hi @tomchentw I'm working on Chakra Play, though I've not done much on it recently, College troubles.🙂 |
Intentions@with-heart @segunadebayo I'd like to share my intentions of creating #4292 and #4345 :
Imagine one organization who's leveraging Chakra-UI. They want to customize theme with a few values: If the docs site allows to import theme from gist, they could simply setup something like:
Want to use a different To prevent confusion, we could add a top-banner indicating that a custom theme is currently applied like I did in #4292 or GIF here: Since the changes are all running locally, the user could always reset to the default theme. Perhaps the real question here: how would you setup a customized Chakra-UI docs site for your organization? Theme ExplorerA theme explorer is definitely useful for a playground situation. When I was reading the customize-theme page in the first place, I'm already imagine having a theme explorer right at that page so that I could try it out directly. Maybe this is one approach we could take from here? On the other hand, I imagine a theme explorer would look similar to a CodeSandbox, leaving this playground more engineering-centered approach compared to the docs site. Plus, the best of the Chakra-UI docs site lies within its massive examples (with various variants and real-world usages). I would imaging it takes efforts to leverage (import) these examples as a separate theme explorer App. Given these, I'm still convinced having a customized theme feature directly in the docs site adds value to it. :) |
@anubra266 I'm impressed with the choc-autocomplete package. Haven't had a chance to try it but looking forward to! I also checked Chakra Play you mentioned here and yeah I'm open to see how it could play together! |
@tomchentw I definitely love this idea. It'll be awesome on Choc UI too. |
📝 Description
I've extracted the key feature from #4292 :
🚀 New behavior
It starts with the newly added icon on the header. It renders a
<Popover />
with an<input />
asking for the Gist URL.The user should provide a Gist URL. It should contain one CommonJS module defined the custom theme. For example,
https://gist.github.com/tomchentw/989ad340001061726bf2c0734d3739cf
🚀 New behavior
We could paste the Gist URL to the input and hit
Apply
. Since the custom theme above changes thexs
size of the<Button />
, It updates the icon size as expected:A static image:
💣 Is this a breaking change (Yes/No):
No
📝 Additional Information
Let me know if this is easier to review, @with-heart . We could ship the
localStorage
feature or `live editing feature later on with more thorough thinking.