@navinc/base-react-components
Version:
Nav's Pattern Library
38 lines • 1.62 kB
JavaScript
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;
};
import { jsx as _jsx } from "react/jsx-runtime";
import { useEffect } from 'react';
import styled from 'styled-components';
import propTypes from 'prop-types';
import { deprecationWarning } from '@navinc/utils';
/*
Adding a $ to props makes them a transient prop
see https://styled-components.com/docs/api#transient-props
*/
export const Text = styled((_a) => {
var { bold, light } = _a, props = __rest(_a, ["bold", "light"]);
useEffect(() => 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 _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;
`;
Text.displayName = 'Text';
Text.propTypes = {
light: propTypes.bool,
bold: propTypes.bool,
};
export default Text;
//# sourceMappingURL=text.js.map