-
Notifications
You must be signed in to change notification settings - Fork 1
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
Sb/add theme basics #725
base: wk/20231120-try-mui-joy
Are you sure you want to change the base?
Sb/add theme basics #725
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './lib/Button'; | ||
|
||
export * from './lib/theme'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { CssVarsProvider, extendTheme } from '@mui/joy/styles'; | ||
import type { PaletteRange } from '@mui/joy/styles'; | ||
|
||
declare module '@mui/joy/styles' { | ||
interface ColorPalettePropOverrides { | ||
// apply to all Joy UI components that support `color` prop | ||
brand: true; | ||
} | ||
|
||
interface Palette { | ||
// this will make the node `secondary` configurable in `extendTheme` | ||
// and add `secondary` to the theme's palette. | ||
brand: { | ||
blue: string; | ||
lightBlue: string; | ||
}; | ||
} | ||
} | ||
export const prendaTheme = extendTheme({ | ||
colorSchemes: { | ||
light: { | ||
palette: { | ||
brand: { | ||
blue: '#0A4872', | ||
lightBlue: '#D7F3FF', | ||
}, | ||
}, | ||
}, | ||
}, | ||
fontFamily: { | ||
body: '"Poppins", sans-serif', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Poppins is only used for headings. Normal body text is Inter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I was putting something there as a placeholder. Where is all of the body/h1 => font documented? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no defined mapping because there shouldn't be. See my comment in Figma on yours. Variants and the underlying html tag (component) are rightfully independent. |
||
}, | ||
}); | ||
|
||
export const ThemeProvider = ({ | ||
children, | ||
}: { | ||
children: React.ReactElement; | ||
}) => <CssVarsProvider theme={prendaTheme}>{children}</CssVarsProvider>; |
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.
Does this not have to be
brand: PaletteRange
? That's what the docs would suggest. Can you link in your PR description to whatever you're following? That's the only what i can judge correct-ness.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.
Also this seems like it would expose
color="brand"
as an option for color-enabled components. But "brand" is not a valid color for us and is not our desired API. So this would be a wrong way to get these values (blue, light blue) in the themeThere 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.
I tried
PalletteRange
and got the following error when I tried to set a value toblue
:Which is why I went with being specific to each one.