UNPKG

@navinc/base-react-components

Version:
95 lines 3.66 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.Pill = void 0; const styled_components_1 = __importStar(require("styled-components")); const is_rebrand_1 = __importDefault(require("./is-rebrand")); const neutralStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.neutral200}; `; const positiveStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.seaturtleGreen100}; `; const informationStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.lightBlue200}; `; const improvementStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.flounderYellow100}; `; const negativeStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.sebastianRed100}; `; const variantStylesMap = { neutral: neutralStyles, positive: positiveStyles, information: informationStyles, improvement: improvementStyles, negative: negativeStyles, }; const rebrandNeutralStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.navNeutral100}; `; const rebrandPositiveStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.navStatusPositive200}; `; const rebrandInformationStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.navStatusPositive200}; `; const rebrandImprovementStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.navSecondary300}; `; const rebrandNegativeStyles = (0, styled_components_1.css) ` background: ${({ theme }) => theme.navStatusNegative200}; `; const rebrandVariantStylesMap = { neutral: rebrandNeutralStyles, positive: rebrandPositiveStyles, information: rebrandInformationStyles, improvement: rebrandImprovementStyles, negative: rebrandNegativeStyles, }; // ensure consistent map typing variantStylesMap; rebrandVariantStylesMap; const variantStyles = ({ variant, theme }) => { if (!variant) { return ''; } return (0, is_rebrand_1.default)(theme) ? rebrandVariantStylesMap[variant] : variantStylesMap[variant]; }; exports.Pill = styled_components_1.default.span.withConfig({ displayName: "brc-sc-Pill", componentId: "brc-sc-1dmjic2" }) ` font-family: ${({ theme }) => theme.fontPrimary}; color: ${({ theme }) => theme.scuttleGray600}; font-size: 0.75em; font-weight: bold; padding: 0.7em 1em; text-align: center; border-radius: 50vh; ${variantStyles} `; //# sourceMappingURL=pill.js.map