UNPKG

@greensight/gds

Version:
15 lines (14 loc) 698 B
import { CSSObject } from '@emotion/react'; /** * Calculate CSS Object from component props with `AllowMedia` type (user can pass object with breakpoints through prop). CSS property can be calculated based on multiple props. */ export declare const useCSSProperty: <T extends Record<string, any>>({ name, props, condition, transform, }: { /** CSS property name. */ name: string; /** Component prop or array of props. */ props: T; /** Add property only if condition equals `true`. */ condition?: boolean; /** Transform function. Applies before property value assignment. */ transform?: (props: Record<keyof T, any>) => string | number; }) => CSSObject | undefined;