UNPKG

@navinc/base-react-components

Version:
44 lines 2.02 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 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Text = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const styled_components_1 = __importDefault(require("styled-components")); const prop_types_1 = __importDefault(require("prop-types")); const utils_1 = require("@navinc/utils"); /* Adding a $ to props makes them a transient prop see https://styled-components.com/docs/api#transient-props */ exports.Text = (0, styled_components_1.default)((_a) => { var { bold, light } = _a, props = __rest(_a, ["bold", "light"]); (0, react_1.useEffect)(() => (0, utils_1.deprecationWarning)(bold, `The \`bold\` prop on Base React Component Text component is deprecated and support will be removed in a future version. Please use \`$bold\` instead.`), [bold]); return (0, jsx_runtime_1.jsx)("span", Object.assign({}, props), void 0); }) ` color: ${({ light, theme }) => (light ? theme.neutral400 : theme.neutral500)}; font-family: postgrotesk, Roboto, Helvetica, sans-serif; font-weight: ${({ bold, $bold }) => (bold || $bold ? 'bold' : 'normal')}; font-size: inherit; line-height: inherit; `; exports.Text.displayName = 'Text'; exports.Text.propTypes = { light: prop_types_1.default.bool, bold: prop_types_1.default.bool, }; exports.default = exports.Text; //# sourceMappingURL=text.js.map