UNPKG

@navinc/base-react-components

Version:
121 lines 4.71 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Header = void 0; const styled_components_1 = __importStar(require("styled-components")); const is_rebrand_1 = __importDefault(require("./is-rebrand")); const variants = { 'nav-blue': { xl: { fontFamily: 'postgrotesk, Averta, Helvetica, sans-serif', fontSize: '32px', lineHeight: '38px', htmlElement: 'h1', }, lg: { fontFamily: 'postgrotesk, Averta, Helvetica, sans-serif', fontSize: '24px', lineHeight: '30px', htmlElement: 'h2', }, md: { fontFamily: 'postgrotesk, Averta, Helvetica, sans-serif', fontSize: '20px', lineHeight: '30px', htmlElement: 'h3', }, sm: { fontFamily: 'postgrotesk, Roboto, Helvetica, sans-serif', fontSize: '18px', lineHeight: '28px', htmlElement: 'h4', }, xs: { fontFamily: 'postgrotesk, Roboto, Helvetica, sans-serif', fontSize: '16px', lineHeight: '24px', htmlElement: 'h4', }, }, 'nav-purple': { xl: { fontFamily: 'Cosmica, sans-serif', fontSize: '56px', lineHeight: '64px', htmlElement: 'h1', }, lg: { fontFamily: 'Cosmica, sans-serif', fontSize: '48px', lineHeight: '56px', htmlElement: 'h2', }, md: { fontFamily: 'Cosmica, sans-serif', fontSize: '32px', lineHeight: '36px', htmlElement: 'h3', }, sm: { fontFamily: 'Cosmica, sans-serif', fontSize: '24px', lineHeight: '32px', htmlElement: 'h4', }, xs: { fontFamily: 'Cosmica, sans-serif', fontSize: '20px', lineHeight: '28px', htmlElement: 'h5', }, }, }; exports.Header = styled_components_1.default.h1.attrs(({ size }) => { var _a, _b; const theme = (_a = (0, styled_components_1.useTheme)()) !== null && _a !== void 0 ? _a : { name: 'nav-blue' }; if (!size) { size = (0, is_rebrand_1.default)(theme) ? 'xs' : 'md'; } return { as: (_b = variants[theme.name][size]) === null || _b === void 0 ? void 0 : _b.htmlElement, size, theme, }; }).withConfig({ displayName: "brc-sc-Header", componentId: "brc-sc-1wvlsd3" }) ` font-family: ${({ size, theme }) => { var _a, _b; return (_b = (_a = variants[theme.name][size]) === null || _a === void 0 ? void 0 : _a.fontFamily) !== null && _b !== void 0 ? _b : variants[theme.name].md.fontFamily; }}; margin-top: 0; margin-bottom: 0; padding: 0; color: ${({ theme }) => ((0, is_rebrand_1.default)(theme) ? theme.navNeutralDark : theme.neutral500)}; font-size: ${({ size, theme }) => { var _a, _b; return (_b = (_a = variants[theme.name][size]) === null || _a === void 0 ? void 0 : _a.fontSize) !== null && _b !== void 0 ? _b : variants[theme.name].md.fontSize; }}; line-height: ${({ size, theme }) => { var _a, _b; return (_b = (_a = variants[theme.name][size]) === null || _a === void 0 ? void 0 : _a.lineHeight) !== null && _b !== void 0 ? _b : variants[theme.name].md.lineHeight; }}; font-weight: bold; `; exports.Header.displayName = 'Header'; exports.default = exports.Header; //# sourceMappingURL=header.js.map