mirror of
https://github.com/zhigang1992/react.git
synced 2026-01-28 22:30:13 +08:00
* feat(scaleable): add scaleable props to each component * chore(scaleable): update the exported type * feat: apply scaleable to components chore: remove with-default test: improve testcase for scaleable chore: resolve test warning ci: upgrade nodejs to latest lts docs: fix type error in document site * docs: update documents to be compatible with scaleable chore: fix build errors * chore: remove all size-related attributes docs: improve guide document * docs: add scaleable documentation test: update snapshots chore: remove unused * feat: add scaleable to grid components * docs: improve docs * test: update snapshots * fix(grid): fix basic component props
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import { NormalTypes } from '../utils/prop-types'
|
|
import { GeistUIThemesPalette } from '../themes/presets'
|
|
|
|
export type InputColor = {
|
|
color: string
|
|
borderColor: string
|
|
hoverBorder: string
|
|
}
|
|
|
|
export const getColors = (
|
|
palette: GeistUIThemesPalette,
|
|
status?: NormalTypes,
|
|
): InputColor => {
|
|
const colors: { [key in NormalTypes]: InputColor } = {
|
|
default: {
|
|
color: palette.foreground,
|
|
borderColor: palette.border,
|
|
hoverBorder: palette.accents_5,
|
|
},
|
|
secondary: {
|
|
color: palette.foreground,
|
|
borderColor: palette.secondary,
|
|
hoverBorder: palette.secondary,
|
|
},
|
|
success: {
|
|
color: palette.foreground,
|
|
borderColor: palette.successLight,
|
|
hoverBorder: palette.success,
|
|
},
|
|
warning: {
|
|
color: palette.foreground,
|
|
borderColor: palette.warningLight,
|
|
hoverBorder: palette.warning,
|
|
},
|
|
error: {
|
|
color: palette.error,
|
|
borderColor: palette.error,
|
|
hoverBorder: palette.errorDark,
|
|
},
|
|
}
|
|
|
|
if (!status) return colors.default
|
|
return colors[status]
|
|
}
|