-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Global Config #142
Comments
Great description! Covered all the bases (at least, the ones that I can see). The user should be able to define a list of default props to use. (eg. all
(eg. a Without having diven too deep into the source code: This seems like a fine way to implement it! (very similar to that PR I made a while back too, so of course I think that 😁 )
Get the config options into a single place. (eg: the gatsby-config turns into an object of options, the Storybook config also turns into that same object of optiond.) |
@NickyMeuleman Hey mate, yeah bang on, I wanted to run this past you because it was your idea. I'll give it first blast and see where i get to and if you have anymore time i'd welcome more feedback. I'll create a PR in the next few days and we can go from there. |
So.. for the component this will be exposed just as |
Is your feature request related to a problem? Please describe.
Currently all props for all components are applied inline. eg, every time you use a
Tweet
component if you wanted to set the theme to "dark" you'd have to do this:Describe the solution you'd like
Nicky Meuleman created a defaultProps PR in the old repo but i never really got round to reviewing it properly.. apologies Nicky 🙂
I'd like to continue this idea but it'll have to be adapted a bit so that it first works with the core package and via a
config
prop on the<MDXEmbedProvider config={...}/>
and each "sub package" will expose a method for passing options on to theMDXEmbedProvider
via the addon/plugin params for each framework, namely Gatsby and StorybookI'm guessing at this point the new config object would contain keys typed to the interfaces for all components. eg
And the
MDXEmbedProvider
would require a new optional prop calledconfig
which is typed asIConfig
Config params would mostly likely be provided by the Context API provider and each component would consume the props for the relevant config key.
Inline props should override global config in case more granular control is required on a single instance usage
For addons/plugins i think the usage will look something like this 👇
Gatsby
Storybook
And for core props i think the usage will look something like this 👇
Core
Describe alternatives you've considered
There's no alternative at this stage
Additional context
For any addon or plugin we'll need to ensure there are ways to pass options on to
MDXEmbedProvider
or if not, be sure to call this out in the docs that "Global Config" is not supported.The text was updated successfully, but these errors were encountered: