Path: blob/1.0-develop/resources/scripts/components/elements/TitledGreyBox.tsx
7461 views
import React, { memo } from 'react';1import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';2import { IconProp } from '@fortawesome/fontawesome-svg-core';3import tw from 'twin.macro';4import isEqual from 'react-fast-compare';56interface Props {7icon?: IconProp;8title: string | React.ReactNode;9className?: string;10children: React.ReactNode;11}1213const TitledGreyBox = ({ icon, title, children, className }: Props) => (14<div css={tw`rounded shadow-md bg-neutral-700`} className={className}>15<div css={tw`bg-neutral-900 rounded-t p-3 border-b border-black`}>16{typeof title === 'string' ? (17<p css={tw`text-sm uppercase`}>18{icon && <FontAwesomeIcon icon={icon} css={tw`mr-2 text-neutral-300`} />}19{title}20</p>21) : (22title23)}24</div>25<div css={tw`p-3`}>{children}</div>26</div>27);2829export default memo(TitledGreyBox, isEqual);303132