UNPKG

@cap3/capitano-components

Version:
44 lines 1.95 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const capitano_theme_1 = require("@cap3/capitano-theme"); exports.Heading = (_a) => { var { children, level } = _a, rest = __rest(_a, ["children", "level"]); const Tag = headings[level - 1]; return React.createElement(Tag, Object.assign({}, rest), children); }; const headerBaseStyle = ({ theme }) => ({ margin: 0, color: theme.colors.textOnBackground, fontFamily: theme.typography.fontFamily.base, fontWeight: "normal", }); exports.H1 = capitano_theme_1.styled("h1")(props => headerBaseStyle(props), ({ theme }) => ({ fontSize: theme.typography.fontSize.h1, })); exports.H2 = capitano_theme_1.styled("h2")(props => headerBaseStyle(props), ({ theme }) => ({ fontSize: theme.typography.fontSize.h2, })); exports.H3 = capitano_theme_1.styled("h3")(props => headerBaseStyle(props), ({ theme }) => ({ fontSize: theme.typography.fontSize.h3, })); exports.H4 = capitano_theme_1.styled("h4")(props => headerBaseStyle(props), ({ theme }) => ({ fontSize: theme.typography.fontSize.h4, })); exports.H5 = capitano_theme_1.styled("h5")(props => headerBaseStyle(props), ({ theme }) => ({ fontSize: theme.typography.fontSize.h5, })); exports.H6 = capitano_theme_1.styled("h6")(props => headerBaseStyle(props), ({ theme }) => ({ fontSize: theme.typography.fontSize.h6, })); const headings = [exports.H1, exports.H2, exports.H3, exports.H4, exports.H5, exports.H6]; //# sourceMappingURL=Heading.js.map