[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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

Provide an API to update the theme from down the tree #21273

Closed
1 task done
devskope opened this issue May 31, 2020 · 4 comments
Closed
1 task done

Provide an API to update the theme from down the tree #21273

devskope opened this issue May 31, 2020 · 4 comments
Labels
new feature New feature or request status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it waiting for 👍 Waiting for upvotes

Comments

@devskope
Copy link
  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

It makes sense to me to abstract the theme generation APIs into a single hook interface that returns the generated theme and a setter function to modify the theme.

Examples 🌈

I published the useMuiTheme hook (@devskope/use-mui-theme) to solve this problem.

import useMuiTheme from '@devskope/use-mui-theme';
  ...
 
const App = (props) => {
  const [theme, setTheme] = useMuiTheme({
       themeOptions = {name: 'winter-blue', palette:{ ...paletteOpts }},
       themeArgs = [],
       responsiveFonts = true,
       fontOptions = {factor: 1},
     });
 
  return (
    <>
      <ThemeProvider theme={theme}>
        <CssBaseline />
        <NavBar setTheme={setTheme} />
      </ThemeProvider>
    </>
  );
};
@oliviertassinari
Copy link
Member

@devskope Thanks for opening an issue. It's the third time I see somebody asking for a theme setter. From what I recall, it was about enabling the dark theme without having to handle the boilerplate around the React's context. What problem do you intend on solving?

@devskope
Copy link
Author
devskope commented May 31, 2020

@oliviertassinari Same problem, cutting down boilerplate and focusing on features .

@oliviertassinari oliviertassinari changed the title Aggregate theme creation functions, bake in dynamic theme updates. Provide an API to update the theme from down the tree May 31, 2020
@oliviertassinari oliviertassinari added new feature New feature or request waiting for 👍 Waiting for upvotes labels May 31, 2020
@siriwatknp
Copy link
Member

I am closing this. The theme should be static moving forward as CSS has evolved with CSS variables.

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@devskope How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@siriwatknp siriwatknp added the status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

3 participants