buildStep.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import styled from '@emotion/styled';
  2. import ListItem from 'sentry/components/list/listItem';
  3. import {space} from 'sentry/styles/space';
  4. interface Props {
  5. children: React.ReactNode;
  6. title: string;
  7. 'data-test-id'?: string;
  8. description?: React.ReactNode;
  9. required?: boolean;
  10. }
  11. export function BuildStep({
  12. title,
  13. description,
  14. required = false,
  15. children,
  16. ...props
  17. }: Props) {
  18. return (
  19. <Wrapper {...props}>
  20. <Heading>
  21. {title}
  22. {required && <RequiredBadge />}
  23. </Heading>
  24. <SubHeading>{description}</SubHeading>
  25. <Content>{children}</Content>
  26. </Wrapper>
  27. );
  28. }
  29. const Wrapper = styled(ListItem)`
  30. display: grid;
  31. `;
  32. const Heading = styled('h5')`
  33. margin-bottom: 0;
  34. color: ${p => p.theme.gray500};
  35. `;
  36. export const SubHeading = styled('small')`
  37. color: ${p => p.theme.gray400};
  38. padding: ${space(0.25)} ${space(2)} ${space(2)} 0;
  39. @media (max-width: ${p => p.theme.breakpoints.small}) {
  40. padding-top: ${space(1)};
  41. margin-left: -${space(4)};
  42. }
  43. `;
  44. const Content = styled('div')`
  45. display: grid;
  46. @media (max-width: ${p => p.theme.breakpoints.small}) {
  47. margin-left: -${space(4)};
  48. }
  49. `;
  50. const RequiredBadge = styled('div')`
  51. background: ${p => p.theme.red300};
  52. opacity: 0.6;
  53. width: 5px;
  54. height: 5px;
  55. border-radius: 5px;
  56. margin-left: ${space(0.5)};
  57. display: inline-block;
  58. vertical-align: super;
  59. `;