@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
54 lines (53 loc) • 1.25 kB
JavaScript
import { buildStyleFns, buildStylePropFn } from './buildStyleFns';
export const flexItemStyleFnConfigs = [
{
name: 'flex',
properties: ['flex'],
system: 'none',
},
{
name: 'flexGrow',
properties: ['flexGrow'],
system: 'none',
},
{
name: 'flexShrink',
properties: ['flexShrink'],
system: 'none',
},
{
name: 'flexBasis',
properties: ['flexBasis'],
system: 'none',
},
{
name: 'justifySelf',
properties: ['justifySelf'],
system: 'none',
},
{
name: 'alignSelf',
properties: ['alignSelf'],
system: 'none',
},
{
name: 'order',
properties: ['order'],
system: 'none',
},
];
export const flexItemStyleFns = buildStyleFns(flexItemStyleFnConfigs);
/**
* A style prop function that takes component props and returns flexbox item styles.
* If no `FlexItemStyleProps` are found, it returns an empty object.
*
* @example
* ```tsx
* const FlexItemExample = () => (
* <Box flex={1} flexBasis="auto" alignSelf={center}>
* Hello, flex item!
* </Box>
* );
* ```
*/
export const flexItem = buildStylePropFn(flexItemStyleFns);