![import { createVar, style, styleVariants } from '@vanilla-extract/css'; import { calc } from '@vanilla-extract/css-utils'; import { sprinkles } from './sprinkles.css'; const hoverScaleValues = { grow: 1.025, growLg: 1.1, } as const; const activeScaleValues = { shrink: 0.95, shrinkSm: 0.9, } as const; const hoverScaleVar = createVar(); const activeScaleVar = createVar(); export const base = style([ sprinkles({ position: 'relative', }), { selectors: { '&::after': { vars: { [activeScaleVar]: '1', [hoverScaleVar]: '1', }, }, '&:active::after': { bottom: 0, content: '""', display: 'block', left: 0, position: 'absolute', right: 0, top: 0, transform: `scale(${calc(1) .divide(activeScaleVar) .multiply(hoverScaleVar) .toString()})`, }, }, }, ]); export const hover = styleVariants(hoverScaleValues, scale => ({](https://pbs.twimg.com/media/FUJRFN3aQAA3WzR.jpg?name=small&format=webp)
ALT import { createVar, style, styleVariants } from '@vanilla-extract/css'; import { calc } from '@vanilla-extract/css-utils'; import { sprinkles } from './sprinkles.css'; const hoverScaleValues = { grow: 1.025, growLg: 1.1, } as const; const activeScaleValues = { shrink: 0.95, shrinkSm: 0.9, } as const; const hoverScaleVar = createVar(); const activeScaleVar = createVar(); export const base = style([ sprinkles({ position: 'relative', }), { selectors: { '&::after': { vars: { [activeScaleVar]: '1', [hoverScaleVar]: '1', }, }, '&:active::after': { bottom: 0, content: '""', display: 'block', left: 0, position: 'absolute', right: 0, top: 0, transform: `scale(${calc(1) .divide(activeScaleVar) .multiply(hoverScaleVar) .toString()})`, }, }, }, ]); export const hover = styleVariants(hoverScaleValues, scale => ({
![import * as styles from './touchableStyles.css'; interface TouchableStylesOptions { hover?: keyof typeof styles.hover; active: keyof typeof styles.active; } export function touchableStyles({ active, hover }: TouchableStylesOptions) { return [ styles.base, hover ? styles.hover[hover] : null, styles.active[active], ] .filter(Boolean) .join(' '); }](https://pbs.twimg.com/media/FUJRKALaQAErtum.jpg?name=small&format=webp)
ALT import * as styles from './touchableStyles.css'; interface TouchableStylesOptions { hover?: keyof typeof styles.hover; active: keyof typeof styles.active; } export function touchableStyles({ active, hover }: TouchableStylesOptions) { return [ styles.base, hover ? styles.hover[hover] : null, styles.active[active], ] .filter(Boolean) .join(' '); }




![const [isEnabled, enable] = useReducer(() => true, false);](https://pbs.twimg.com/media/FRzBvUIagAAFKfT.jpg?name=small&format=webp)












