UNPKG

@janiscommerce/ui-native

Version:
20 lines (19 loc) 667 B
import { StyleSheet } from 'react-native'; import typography from '../../../../../theme/typography'; const getStyleByTypography = (type = 'body', size = 'medium', color) => { const validType = Object.keys(typography).includes(type) ? type : 'body'; const typographyCategory = typography[validType]; const validSize = Object.keys(typographyCategory).includes(size) ? size : 'medium'; const typographyStyle = typographyCategory[validSize]; return StyleSheet.create({ typography: { ...typographyStyle, ...(color && { color }), }, }); }; export default getStyleByTypography;