Repository navigation
MSPCA-32 Add Chakra UI v3 and theme.ts #15
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
de36f88
Add Chakra UI v3 and theme.ts from the MSPCA UI Kit
Juwang110 b7c0126
cut comment
Juwang110 ea19e62
Put font weight in text styles and use defineTextStyles
Juwang110 72d0512
Import Amplify UI styles so the sign-in form survives Chakra's reset
Juwang110 d5af3cc
Add black token, xs/2xs text styles, and load all Montserrat weights
Juwang110 68ed006
Merge branch 'main' into jw/mspca-32-theme-chakra
Juwang110 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| import { | ||
| createSystem, | ||
| defaultConfig, | ||
| defineConfig, | ||
| defineTextStyles, | ||
| } from '@chakra-ui/react'; | ||
|
|
||
| export const colors = { | ||
| black: '#000000', | ||
| gray: { | ||
| 0: '#ffffff', | ||
| 50: '#fafafa', | ||
| 100: '#f4f4f5', | ||
| 200: '#e4e4e7', | ||
| 300: '#d4d4d8', | ||
| 400: '#a1a1aa', | ||
| 500: '#71717a', | ||
| 600: '#52525b', | ||
| 700: '#3f3f46', | ||
| 800: '#27272a', | ||
| 900: '#18181b', | ||
| }, | ||
| error: { | ||
| 50: '#fef2f2', | ||
| 100: '#ef4444', | ||
| }, | ||
| blue: { | ||
| primary: '#009cde', | ||
| blue2: '#0d5b90', | ||
| blue3: '#2c4068', | ||
| }, | ||
| orange: { | ||
| orange1: '#dea631', | ||
| orange2: '#e9954b', | ||
| orange3: '#e17152', | ||
| }, | ||
| green: { | ||
| green1: '#88b613', | ||
| green2: '#769b3d', | ||
| }, | ||
| teal: { | ||
| teal: '#4ba2a6', | ||
| }, | ||
| brown: { | ||
| brown: '#5e3638', | ||
| }, | ||
| neutrals: { | ||
|
dburkhart07 marked this conversation as resolved.
|
||
| black: '#231f20', | ||
| black85: '#4d4d4f', | ||
| grey: '#858f98', | ||
| }, | ||
| trello: { | ||
| noRestrictions: '#174b35', | ||
| dogFreeHome: '#87b400', | ||
| catFreeHome: '#9f4b00', | ||
| activityRestriction: '#5d1f1a', | ||
| childFreeHome: '#ae2e24', | ||
| petFreeHome: '#813ea5', | ||
| requiresMedication: '#1458bc', | ||
| }, | ||
| } as const; | ||
|
|
||
| const toColorTokens = (palette: typeof colors) => | ||
| Object.fromEntries( | ||
| Object.entries(palette).map(([group, shades]) => [ | ||
| group, | ||
| typeof shades === 'string' | ||
| ? { value: shades } | ||
| : Object.fromEntries( | ||
| Object.entries(shades).map(([shade, value]) => [shade, { value }]), | ||
| ), | ||
| ]), | ||
| ); | ||
|
|
||
| const textStyle = ( | ||
| mobile: string, | ||
| desktop: string, | ||
| lineHeight: string, | ||
| font: 'heading' | 'body' = 'heading', | ||
| ) => ({ | ||
| value: { | ||
| fontFamily: font, | ||
| fontSize: { base: mobile, md: desktop }, | ||
| fontWeight: font === 'heading' ? 'semibold' : 'normal', | ||
| lineHeight, | ||
| letterSpacing: '0', | ||
| }, | ||
| }); | ||
|
|
||
| const textStyles = defineTextStyles({ | ||
| h1: textStyle('36px', '60px', '1.5'), | ||
| h2: textStyle('32px', '48px', '1.5'), | ||
| h3: textStyle('28px', '36px', '1.5'), | ||
| h4: textStyle('24px', '30px', '1.533'), | ||
| h5: textStyle('20px', '24px', '1.5'), | ||
| h6: textStyle('18px', '20px', '1.5'), | ||
| h7: textStyle('16px', '18px', '1.556'), | ||
| body: textStyle('14px', '16px', '1.5', 'body'), | ||
| 'body-small': textStyle('12px', '14px', '1.43', 'body'), | ||
|
Juwang110 marked this conversation as resolved.
|
||
| xs: textStyle('10px', '12px', '1rem', 'body'), | ||
| '2xs': textStyle('8px', '10px', '0.75rem', 'body'), | ||
| }); | ||
|
|
||
| const config = defineConfig({ | ||
| theme: { | ||
| tokens: { | ||
| colors: toColorTokens(colors), | ||
| fonts: { | ||
| heading: { value: "'Montserrat', sans-serif" }, | ||
| body: { value: "'Montserrat', sans-serif" }, | ||
| }, | ||
| fontWeights: { | ||
| thin: { value: '100' }, | ||
| extralight: { value: '200' }, | ||
| light: { value: '300' }, | ||
| normal: { value: '400' }, | ||
| medium: { value: '500' }, | ||
| semibold: { value: '600' }, | ||
| bold: { value: '700' }, | ||
| extrabold: { value: '800' }, | ||
| black: { value: '900' }, | ||
| }, | ||
| }, | ||
| semanticTokens: { | ||
| colors: { | ||
| bg: { | ||
| DEFAULT: { value: '{colors.gray.0}' }, | ||
| subtle: { value: '{colors.gray.50}' }, | ||
| muted: { value: '{colors.gray.100}' }, | ||
| emphasized: { value: '{colors.gray.200}' }, | ||
| inverted: { value: '{colors.black}' }, | ||
| panel: { value: '{colors.gray.0}' }, | ||
| error: { value: '{colors.error.50}' }, | ||
| }, | ||
| fg: { | ||
| DEFAULT: { value: '{colors.black}' }, | ||
| subtle: { value: '{colors.gray.400}' }, | ||
| muted: { value: '{colors.gray.600}' }, | ||
| inverted: { value: '{colors.gray.50}' }, | ||
| error: { value: '{colors.error.100}' }, | ||
| }, | ||
| border: { | ||
| DEFAULT: { value: '{colors.gray.200}' }, | ||
| subtle: { value: '{colors.gray.50}' }, | ||
| muted: { value: '{colors.gray.100}' }, | ||
| emphasized: { value: '{colors.gray.300}' }, | ||
| inverted: { value: '{colors.gray.800}' }, | ||
| error: { value: '{colors.error.100}' }, | ||
| }, | ||
| text: { | ||
| fg: { value: '{colors.black}' }, | ||
| fg_muted: { value: '{colors.gray.600}' }, | ||
| fg_subtle: { value: '{colors.gray.400}' }, | ||
| fg_error: { value: '{colors.error.100}' }, | ||
| }, | ||
| neutral: { | ||
| contrast: { value: '{colors.gray.0}' }, | ||
| fg: { value: '{colors.gray.800}' }, | ||
| subtle: { value: '{colors.gray.100}' }, | ||
| muted: { value: '{colors.gray.200}' }, | ||
| emphasized: { value: '{colors.gray.300}' }, | ||
| solid: { value: '{colors.gray.900}' }, | ||
| focusRing: { value: '{colors.gray.400}' }, | ||
| }, | ||
| }, | ||
| }, | ||
| textStyles, | ||
| }, | ||
| globalCss: { | ||
| body: { | ||
| textStyle: 'body', | ||
| color: 'fg', | ||
| bg: 'bg', | ||
| }, | ||
| h1: { textStyle: 'h1' }, | ||
| h2: { textStyle: 'h2' }, | ||
| h3: { textStyle: 'h3' }, | ||
| h4: { textStyle: 'h4' }, | ||
| h5: { textStyle: 'h5' }, | ||
| h6: { textStyle: 'h6' }, | ||
| 'p, li, label': { textStyle: 'body' }, | ||
| 'small, figcaption': { textStyle: 'body-small' }, | ||
| a: { color: 'blue.primary', textDecoration: 'underline' }, | ||
| 'button, input, textarea, select': { fontFamily: 'body' }, | ||
| }, | ||
| }); | ||
|
|
||
| export const system = createSystem(defaultConfig, config); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.