-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Adding universal ThemeProvider package, initial checkin. #12996
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
Adding universal ThemeProvider package, initial checkin. #12996
Conversation
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: ce5c014aa4c23951afe4d1ca5e45ddb711e2f0fc (build) |
ecraig12345
left a comment
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.
Left some comments about build-related stuff.
Also from the lockfile it looks like there might be some dependency version mismatches.
change/@fluentui-react-2020-05-05-09-14-40-feat-react-theme-provider.json
Outdated
Show resolved
Hide resolved
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Perf comparison
Perf tests with no regressions
|
khmakoto
left a comment
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.
Approved with minor nits.
Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com>
Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com>
…eat/react-theme-provider
| const parentTheme = useTheme(); | ||
|
|
||
| // Merge the theme only when parent theme or props theme mutates. | ||
| const fullTheme = React.useMemo<ThemePrepared>(() => mergeThemes(parentTheme, theme), [parentTheme, theme]); |
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.
As theme is a prop it can be inline object: <ThemeProvider theme={{ foo: 'bar' }} />. It means that all consumers will receive updates on each render as fullTheme is passed to React context.
| { theme, style, className, ...rest }: React.PropsWithChildren<ThemeProviderProps>, | ||
| ref: React.Ref<HTMLDivElement>, |
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.
There is no need to specify these types obviously
|
🎉 Handy links: |
This PR introduces a universal generalized ThemeProvider package. It currently does 2 things:
See the
README.mdfor usage.Includes:
Microsoft Reviewers: Open in CodeFlow