UNPKG

@patreon/studio

Version:

Patreon Studio Design System

38 lines 1.53 kB
import cx from 'classnames'; import styles from './CustomText.module.css'; /** * Generates a className and style object which can be used to style a custom typography bundle. * * This function requires that you define all the propeties of your typographic style * completely. If you only need to change a few properties, use the `typeTokens` object * to fill in the original, default values. * * @warning this should be only used as an escape hatch for when Text components * and typography bundles are not capable of supporting the desired typography. */ export function escapeForCustomText({ fontStack, fontSize, fontWeight, letterSpacing, lineHeight, fontWidth, }) { if (fontWidth) { return { className: cx(styles.root, styles.mono), style: { '--CustomText-fontStack': fontStack, '--CustomText-fontSize': fontSize, '--CustomText-fontWeight': fontWeight, '--CustomText-letterSpacing': letterSpacing, '--CustomText-lineHeight': lineHeight, '--CustomText-fontWidth': fontWidth, }, }; } return { className: styles.root, style: { '--CustomText-fontStack': fontStack, '--CustomText-fontSize': fontSize, '--CustomText-fontWeight': fontWeight, '--CustomText-letterSpacing': letterSpacing, '--CustomText-lineHeight': lineHeight, }, }; } //# sourceMappingURL=escapeForCustomText.js.map