UNPKG

@redocly/portal-legacy-ui

Version:

Library of legacy portal UI components

27 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.typography = typography; const styled_components_1 = require("styled-components"); const typographyProperties = Object.entries({ fontSize: 'font-size', fontWeight: 'font-weight', fontFamily: 'font-family', lineHeight: 'line-height', color: 'text-color', textTransform: 'text-transform', }); function getTypographyCssRulesByComponentName(componentName, fallbackName) { const result = {}; for (const [styledPropertyName, cssPropertyName] of typographyProperties) { const cssVariable = `--${componentName}-${cssPropertyName}`; const fallbackVariable = fallbackName ? `,var(--${fallbackName}-${cssPropertyName})` : ''; result[styledPropertyName] = `var(${cssVariable}${fallbackVariable})`; } return result; } function typography(componentName, fallbackName) { return (0, styled_components_1.css) ` ${getTypographyCssRulesByComponentName(componentName, fallbackName)} `; } //# sourceMappingURL=utils.js.map