import { ReactNode } from 'react'; import styled from '@emotion/styled'; import { css } from '@emotion/react'; import { mineShaft } from 'styles/colors'; import { fontWeight, fontSize } from 'styles/fonts'; export const HeadingGroup = styled.div` display: flex; justify-content: space-between; align-items: center; `; const Heading = styled.span>` flex: 1 0 auto; margin: 0.5em 0; color: ${mineShaft['500']}; font-weight: ${fontWeight.bold}; line-height: 1.286; ${({ size }) => { switch (size) { case 'large': return css` font-size: ${fontSize.large}; color: ${mineShaft['900']}; `; case 'default': default: return css` font-size: ${fontSize.small}; text-transform: uppercase; `; } }}; `; interface Props { size?: 'default' | 'large'; htmlTag?: string; children?: ReactNode; [rest: string]: any; } const HeadingComp = ({ size = 'default', htmlTag = 'span', children = null, ...rest }: Props) => { const HeadingWithTag = Heading.withComponent(htmlTag as any); return ( {children} ); }; export default HeadingComp;