@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
82 lines (81 loc) • 1.85 kB
JavaScript
import { buildStyleFns, buildStylePropFn } from './buildStyleFns';
export const textStyleFnConfigs = [
{
name: 'fontFamily',
properties: ['fontFamily'],
system: 'font',
},
{
name: 'fontSize',
properties: ['fontSize'],
system: 'fontSize',
},
{
name: 'fontStyle',
properties: ['fontStyle'],
system: 'none',
},
{
name: 'fontWeight',
properties: ['fontWeight'],
system: 'fontWeight',
},
{
name: 'lineHeight',
properties: ['lineHeight'],
system: 'none',
},
{
name: 'letterSpacing',
properties: ['letterSpacing'],
system: 'none',
},
{
name: 'textAlign',
properties: ['textAlign'],
system: 'none',
},
{
name: 'textDecoration',
properties: ['textDecoration'],
system: 'none',
},
{
name: 'textOverflow',
properties: ['textOverflow'],
system: 'none',
},
{
name: 'textTransform',
properties: ['textTransform'],
system: 'none',
},
{
name: 'textShadow',
properties: ['textShadow'],
system: 'none',
},
{
name: 'whiteSpace',
properties: ['whiteSpace'],
system: 'none',
},
{
name: 'wordBreak',
properties: ['wordBreak'],
system: 'none',
},
];
export const textStyleFns = buildStyleFns(textStyleFnConfigs);
/**
* A style prop function that takes component props and returns font and text styles.
* If no `TextStyleProps` are found, it returns an empty object.
*
* @example
* ```
* const BoxExample = () => (
* <Box textAlign="center" fontWeight="medium">Hello, alignment!</Box>
* );
* ```
*/
export const text = buildStylePropFn(textStyleFns);