Files
react/components/checkbox/styles.ts
gepd 5bbce55465 feat: add status prop in checkbox, radio, select, slider and toggle (#530)
* feat: added status prop to set color by states

test: check status success, warning and error

* docs: added playground example and API reference

fix: replaced ´_´ as it's not recommended to use

fix: removed redundant return

refactor: renamed prop from status to type

test: update test with the renamed prop

* docs: update prop references from status to type

fix: status prop not updated to type

fix: missing return

* fix(select): set icons and hover state to follow the theme

* test(slider): update snapshots

* chore: always use relative paths when import types

Co-authored-by: unix <unix.bio@gmail.com>
2021-08-13 17:06:27 +08:00

39 lines
821 B
TypeScript

import { GeistUIThemesPalette } from '../themes/presets'
import { NormalTypes } from '../utils/prop-types'
export type CheckboxColor = {
fill: string
bg: string
}
export const getColors = (
palette: GeistUIThemesPalette,
status?: NormalTypes,
): CheckboxColor => {
const colors: { [key in NormalTypes]: CheckboxColor } = {
default: {
fill: palette.foreground,
bg: palette.background,
},
secondary: {
fill: palette.foreground,
bg: palette.background,
},
success: {
fill: palette.success, // fondo
bg: palette.background,
},
warning: {
fill: palette.warning,
bg: palette.background,
},
error: {
fill: palette.error,
bg: palette.background,
},
}
if (!status) return colors.default
return colors[status]
}