@sinchsmb/ui-kit
Version:
UI kit for SinchSMB frontend
20 lines (17 loc) • 499 B
text/typescript
import get from 'lodash/get';
import { PropsWithTheme, TypographyToken, TypographyTokenRef } from './types';
/**
* Returns font that can be used inside styled-component.
*
* ```tsx
* import styled from 'styled-components/macro';
* import { font } from '../theme';
*
* const StyledDiv = styled.div`
* ${typography('caption')}
* `;
* ```
*/
export function typography(name: TypographyTokenRef) {
return (props: PropsWithTheme): TypographyToken => get(props.theme, name.split('/'));
}