card.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import styled from '@emotion/styled';
  2. import Button from 'app/components/button';
  3. import {IconEdit, IconLock} from 'app/icons';
  4. import {t} from 'app/locale';
  5. import space from 'app/styles/space';
  6. type Props = {
  7. children: React.ReactNode;
  8. onEdit: () => void;
  9. };
  10. function Card({children, onEdit}: Props) {
  11. return (
  12. <Wrapper>
  13. <IconWrapper>
  14. <IconLock size="lg" />
  15. </IconWrapper>
  16. <Content>{children}</Content>
  17. <Action>
  18. <Button icon={<IconEdit />} label={t('Edit')} size="small" onClick={onEdit} />
  19. </Action>
  20. </Wrapper>
  21. );
  22. }
  23. export default Card;
  24. const Wrapper = styled('div')`
  25. display: grid;
  26. grid-template-columns: max-content 1fr max-content;
  27. grid-gap: ${space(1)};
  28. `;
  29. const Content = styled('div')`
  30. display: flex;
  31. justify-content: center;
  32. flex-direction: column;
  33. font-size: ${p => p.theme.fontSizeMedium};
  34. `;
  35. const IconWrapper = styled('div')`
  36. display: flex;
  37. align-items: center;
  38. padding: 0 ${space(1.5)};
  39. `;
  40. const Action = styled('div')`
  41. display: flex;
  42. align-items: center;
  43. `;