descriptionCard.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import {ReactNode} from 'react';
  2. import styled from '@emotion/styled';
  3. import space from 'app/styles/space';
  4. type Props = {
  5. title: string;
  6. description: ReactNode;
  7. children: ReactNode;
  8. };
  9. function DescriptionCard({title, description, children}: Props) {
  10. return (
  11. <Wrapper>
  12. <LeftPanel>
  13. <Title>{title}</Title>
  14. <Description>{description}</Description>
  15. </LeftPanel>
  16. <RightPanel>{children}</RightPanel>
  17. </Wrapper>
  18. );
  19. }
  20. export default DescriptionCard;
  21. const Wrapper = styled('div')`
  22. border: 1px solid ${p => p.theme.border};
  23. border-radius: ${p => p.theme.borderRadius};
  24. display: flex;
  25. margin-bottom: ${space(3)};
  26. flex-direction: column;
  27. @media (min-width: ${p => p.theme.breakpoints[1]}) {
  28. flex-direction: row;
  29. }
  30. `;
  31. const LeftPanel = styled('div')`
  32. padding: ${space(2)} ${space(2)};
  33. border-bottom: 1px solid ${p => p.theme.border};
  34. @media (min-width: ${p => p.theme.breakpoints[1]}) {
  35. max-width: 250px;
  36. border-right: 1px solid ${p => p.theme.border};
  37. border-bottom: 0;
  38. }
  39. `;
  40. const Title = styled('div')`
  41. font-size: ${p => p.theme.fontSizeLarge};
  42. margin: 0 0 ${space(0.5)};
  43. `;
  44. const Description = styled('div')`
  45. color: ${p => p.theme.subText};
  46. font-size: ${p => p.theme.fontSizeMedium};
  47. `;
  48. const RightPanel = styled('div')`
  49. flex-grow: 1;
  50. `;