mirror of
https://github.com/zhigang1992/react.git
synced 2026-06-19 01:36:51 +08:00
* refactor(themes): refactor theme module to keep multiple themes * chore: migrate APIs to be compatible with new theme system * test: update snapshots * chore: migrate the path of the theme module * feat(themes): append static methods of themes * chore: hide custom theme when no custom content in the context * chore: manually add flush to preload styles in html * docs(themes): update to fit the new theme system
36 lines
868 B
TypeScript
36 lines
868 B
TypeScript
import { NormalSizes } from 'components/utils/prop-types'
|
|
import { GeistUIThemes } from 'components/themes/presets'
|
|
|
|
export interface SelectSize {
|
|
height: string
|
|
fontSize: string
|
|
minWidth: string
|
|
}
|
|
|
|
export const getSizes = (theme: GeistUIThemes, size?: NormalSizes) => {
|
|
const sizes: { [key in NormalSizes]: SelectSize } = {
|
|
medium: {
|
|
height: `calc(1.688 * ${theme.layout.gap})`,
|
|
fontSize: '.875rem',
|
|
minWidth: '10rem',
|
|
},
|
|
small: {
|
|
height: `calc(1.344 * ${theme.layout.gap})`,
|
|
fontSize: '.75rem',
|
|
minWidth: '8rem',
|
|
},
|
|
mini: {
|
|
height: `calc(1 * ${theme.layout.gap})`,
|
|
fontSize: '.75rem',
|
|
minWidth: '6.5rem',
|
|
},
|
|
large: {
|
|
height: `calc(2 * ${theme.layout.gap})`,
|
|
fontSize: '1.225rem',
|
|
minWidth: '12.5rem',
|
|
},
|
|
}
|
|
|
|
return size ? sizes[size] : sizes.medium
|
|
}
|