UNPKG

@retailmenot/anchor

Version:

A React UI Library by RetailMeNot

53 lines (49 loc) 1.95 kB
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; }; // REACT import * as React from 'react'; // VENDOR import styled, { css } from '@xstyled/styled-components'; import classnames from 'classnames'; import { space as spaceStyles } from '@xstyled/system'; // ANCHOR import { Typography } from '../../Typography'; import { StyledContent } from '../Content/Content.component'; export const StyledHeader = styled('div') ` box-sizing: border-box; min-height: 4rem; padding: 1.25rem 4.75rem 1.25rem 2rem; width: 100%; border-radius: modal modal 0 0; margin-bottom: 1rem; display: flex; order: -1; ${({ color = 'text.light', background = 'white' }) => css({ color, backgroundColor: background, })}; // If the header exists, remove the Content's padding. // We're preferring this selector to using Modal :first-child // in case there is a close button placed before it, and using a // double selector to ensure it takes precedence. & ~ ${StyledContent}${StyledContent} { padding-top: 0; } ${spaceStyles} `; export const ModalHeader = (_a) => { var { children, className, title } = _a, props = __rest(_a, ["children", "className", "title"]); return (React.createElement(StyledHeader, Object.assign({ className: classnames('anchor-modal-header', className) }, props), title && (React.createElement(Typography, { scale: 20, weight: "bold" }, title)), children)); }; //# sourceMappingURL=Header.component.js.map