listGroup.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import styled from '@emotion/styled';
  2. import space from 'sentry/styles/space';
  3. type ListGroupProps = {
  4. striped?: boolean;
  5. };
  6. type ListGroupItemProps = {
  7. centered?: boolean;
  8. };
  9. const ListGroupItem = styled('li')<ListGroupItemProps>`
  10. position: relative;
  11. display: block;
  12. min-height: 36px;
  13. border: 1px solid ${p => p.theme.border};
  14. padding: ${space(0.5)} ${space(1.5)};
  15. margin-bottom: -1px;
  16. ${p => (p.centered ? 'text-align: center;' : '')}
  17. &:first-child {
  18. border-top-left-radius: ${p => p.theme.borderRadius};
  19. border-top-right-radius: ${p => p.theme.borderRadius};
  20. }
  21. &:last-child {
  22. border-bottom-left-radius: ${p => p.theme.borderRadius};
  23. border-bottom-right-radius: ${p => p.theme.borderRadius};
  24. }
  25. `;
  26. const ListGroup = styled('ul')<ListGroupProps>`
  27. box-shadow: 0 1px 0px rgba(0, 0, 0, 0.03);
  28. background: ${p => p.theme.background};
  29. padding: 0;
  30. margin: 0;
  31. ${p =>
  32. p.striped
  33. ? `
  34. & > li:nth-child(odd) {
  35. background: ${p.theme.backgroundSecondary};
  36. }
  37. `
  38. : ''}
  39. `;
  40. export {ListGroup, ListGroupItem};