Files
link-free/src/components/Button/styles.ts

232 lines
5.5 KiB
TypeScript
Raw Normal View History

2021-12-13 17:12:51 -03:00
import { Colors, styled, theme, VariantProps } from '../../styles/stitches.config'
2021-12-11 01:48:15 -03:00
2021-12-13 17:12:51 -03:00
const themeVariantFn = (
lightColor: Colors,
regularColor: Colors,
darkColor: Colors,
darkerColor: Colors
2021-12-11 01:48:15 -03:00
) => ({
background: theme.colors[regularColor],
borderColor: theme.colors[regularColor],
color: theme.colors[lightColor],
'&:hover': {
background: theme.colors[darkColor],
borderColor: theme.colors[darkColor]
},
'&:active': {
background: theme.colors[darkerColor],
borderColor: theme.colors[darkerColor]
}
})
2021-12-13 17:12:51 -03:00
const outlineVariantFn = (color: Colors) => ({
2021-12-12 23:45:41 -03:00
color: theme.colors[color],
2021-12-11 01:48:15 -03:00
'&:hover': {
2021-12-12 23:45:41 -03:00
background: 'rgba(0, 0, 0, 0.05)'
2021-12-11 01:48:15 -03:00
},
'&:active': {
2021-12-12 23:45:41 -03:00
background: 'rgba(0, 0, 0, 0.1)'
2021-12-11 01:48:15 -03:00
}
})
export const Wrapper = styled('button', {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: '100%',
height: '3rem',
borderWidth: '2.5px',
borderStyle: 'solid',
fontSize: '1rem',
2021-12-12 23:45:41 -03:00
fontWeight: 500,
2021-12-11 01:48:15 -03:00
cursor: 'pointer',
transition: 'all 0.25s ease-in-out',
'&:hover': {
transform: 'translateY(-0.15rem)'
},
variants: {
2021-12-13 17:12:51 -03:00
theme: {
slate: themeVariantFn('slate50', 'slate600', 'slate700', 'slate800'),
gray: themeVariantFn('gray50', 'gray600', 'gray700', 'gray800'),
zinc: themeVariantFn('zinc50', 'zinc600', 'zinc700', 'zinc800'),
neutral: themeVariantFn('neutral50', 'neutral600', 'neutral700', 'neutral800'),
stone: themeVariantFn('stone50', 'stone600', 'stone700', 'stone800'),
red: themeVariantFn('red50', 'red600', 'red700', 'red800'),
orange: themeVariantFn('orange50', 'orange600', 'orange700', 'orange800'),
amber: themeVariantFn('amber50', 'amber600', 'amber700', 'amber800'),
yellow: themeVariantFn('yellow50', 'yellow600', 'yellow700', 'yellow800'),
lime: themeVariantFn('lime50', 'lime600', 'lime700', 'lime800'),
green: themeVariantFn('green50', 'green600', 'green700', 'green800'),
emerald: themeVariantFn('emerald50', 'emerald600', 'emerald700', 'emerald800'),
teal: themeVariantFn('teal50', 'teal600', 'teal700', 'teal800'),
cyan: themeVariantFn('cyan50', 'cyan600', 'cyan700', 'cyan800'),
sky: themeVariantFn('sky50', 'sky600', 'sky700', 'sky800'),
blue: themeVariantFn('blue50', 'blue600', 'blue700', 'blue800'),
indigo: themeVariantFn('indigo50', 'indigo600', 'indigo700', 'indigo800'),
violet: themeVariantFn('violet50', 'violet600', 'violet700', 'violet800'),
purple: themeVariantFn('purple50', 'purple600', 'purple700', 'purple800'),
fuchsia: themeVariantFn('fuchsia50', 'fuchsia600', 'fuchsia700', 'fuchsia800'),
pink: themeVariantFn('pink50', 'pink600', 'pink700', 'pink800'),
rose: themeVariantFn('rose50', 'rose600', 'rose700', 'rose800')
2021-12-11 01:48:15 -03:00
},
schema: {
square: {
borderRadius: '0'
},
rounded: {
borderRadius: '0.5rem'
},
pill: {
borderRadius: '9999px'
2021-12-11 12:37:12 -03:00
}
},
2021-12-12 23:45:41 -03:00
font: {
baloo: {
fontFamily: theme.fonts.baloo
},
montserrat: {
fontFamily: theme.fonts.montserrat
},
roboto: {
fontFamily: theme.fonts.roboto
}
},
2021-12-11 12:37:12 -03:00
outline: {
true: {
2021-12-11 01:48:15 -03:00
background: 'transparent'
}
}
},
compoundVariants: [
{
2021-12-13 17:12:51 -03:00
theme: 'slate',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('slate600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'gray',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('gray600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'zinc',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('zinc600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'neutral',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('neutral600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'stone',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('stone600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'red',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('red600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'orange',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('orange600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'amber',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('amber600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'yellow',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('yellow600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'lime',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('lime600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'green',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('green600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'emerald',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('emerald600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'teal',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('teal600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'cyan',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('cyan600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'sky',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('sky600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'blue',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('blue600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'indigo',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('indigo600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'violet',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('violet600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'purple',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('purple600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'fuchsia',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('fuchsia600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'pink',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('pink600')
2021-12-11 01:48:15 -03:00
},
{
2021-12-13 17:12:51 -03:00
theme: 'rose',
2021-12-11 12:37:12 -03:00
outline: true,
2021-12-12 23:45:41 -03:00
css: outlineVariantFn('rose600')
2021-12-11 01:48:15 -03:00
}
],
defaultVariants: {
2021-12-13 17:12:51 -03:00
theme: 'teal',
2021-12-11 12:37:12 -03:00
schema: 'pill',
2021-12-12 23:45:41 -03:00
font: 'roboto',
2021-12-11 12:37:12 -03:00
outline: false
2021-12-11 01:48:15 -03:00
}
})
2021-12-11 13:42:11 -03:00
export type ButtonVariantProps = VariantProps<typeof Wrapper>