timeline.tsx 774 B

1234567891011121314151617181920212223242526272829
  1. import styled from '@emotion/styled';
  2. /**
  3. * Use grid to create columns that we can place child nodes into.
  4. * Leveraging grid for alignment means we don't need to calculate percent offset
  5. * nor use position:absolute to lay out items.
  6. *
  7. * <Columns>
  8. * <Col>...</Col>
  9. * <Col>...</Col>
  10. * </Columns>
  11. */
  12. export const Columns = styled('ul')<{remainder: number; totalColumns: number}>`
  13. /* Reset defaults for <ul> */
  14. list-style: none;
  15. margin: 0;
  16. padding: 0;
  17. height: 100%;
  18. width: 100%;
  19. /* Layout of the lines */
  20. display: grid;
  21. grid-template-columns: repeat(${p => p.totalColumns}, 1fr) ${p => p.remainder}fr;
  22. place-items: stretch;
  23. `;
  24. // Export an empty component which so that callsites can correctly nest nodes:
  25. export const Col = styled('li')``;