-
Notifications
You must be signed in to change notification settings - Fork 53
Conversation
ddf7685
to
cebccfc
Compare
cebccfc
to
2954cbe
Compare
…com/stardust-ui/react into feat/use-styles-hook
…/react into feat/use-styles-hook
options: UseStylesOptions<StyleProps>, | ||
): [GetStylesResult['classes'], GetStylesResult['styles']] => { | ||
const context: StylesContextValue<{ renderRule: RendererRenderRule }> = | ||
React.useContext(ThemeContext) || defaultContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ideas on how we could decouple this call from the concrete theme? It would be nice to be able to reuse the base components with a different design system (which would likely have a separate theme shape).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is next stage goal 🙇♂️
This is actually even not ThemeContext
as it contains everything, like renderer
and disableAnimations
. Currently we can't we have multiple contexts as the most of our components are class components 🙃
I have a naive idea that we will be able to move out renderer
to a separate context and use the same interface different engines, https://codesandbox.io/embed/t-rex-proto-1w8bp
…com/stardust-ui/react into feat/use-styles-hook
…com/stardust-ui/react into feat/use-styles-hook
Changed dependencies are detected.Changed dependencies in
Perf comparison
Generated by 🚫 dangerJS |
This PR adds
useStyles()
to reuse theming capabilities in custom and Fluent components and have the same API for public and private usage.Usage
The example below assumes a component called
<Text>
will be used this way:Reference
displayName
- a component name to lookup in themeoptions.className
- optional, a special class name that will be always added to theroot
slotoptions.mapPropsToStyles
- optional, a set of props that will be passed style functions, only primitives are allowedoptions.rtl
- optional, sets RTL mode