ClusterTab.styled.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import styled, { css } from 'styled-components';
  2. import { ServerStatus } from 'generated-sources';
  3. export const Wrapper = styled.li.attrs({ role: 'menuitem' })(
  4. ({ theme }) => css`
  5. font-size: 14px;
  6. font-weight: 500;
  7. user-select: none;
  8. display: grid;
  9. grid-template-columns: min-content min-content auto min-content;
  10. grid-template-areas: 'title status . chevron';
  11. gap: 0px 5px;
  12. padding: 0.5em 0.75em;
  13. cursor: pointer;
  14. text-decoration: none;
  15. margin: 0;
  16. line-height: 20px;
  17. align-items: center;
  18. color: ${theme.menu.color.normal};
  19. background-color: ${theme.menu.backgroundColor.normal};
  20. &:hover {
  21. background-color: ${theme.menu.backgroundColor.hover};
  22. color: ${theme.menu.color.hover};
  23. }
  24. `
  25. );
  26. export const Title = styled.div`
  27. grid-area: title;
  28. white-space: nowrap;
  29. max-width: 110px;
  30. overflow: hidden;
  31. text-overflow: ellipsis;
  32. `;
  33. export const StatusIconWrapper = styled.svg.attrs({
  34. viewBox: '0 0 4 4',
  35. xmlns: 'http://www.w3.org/2000/svg',
  36. })`
  37. grid-area: status;
  38. fill: none;
  39. width: 4px;
  40. height: 4px;
  41. `;
  42. export const StatusIcon = styled.circle.attrs({
  43. cx: 2,
  44. cy: 2,
  45. r: 2,
  46. })<{ status: ServerStatus }>(
  47. ({ theme, status }) => css`
  48. fill: ${status === ServerStatus.ONLINE
  49. ? theme.menu.statusIconColor.online
  50. : theme.menu.statusIconColor.offline};
  51. `
  52. );
  53. export const ChevronWrapper = styled.svg.attrs({
  54. viewBox: '0 0 10 6',
  55. xmlns: 'http://www.w3.org/2000/svg',
  56. })`
  57. grid-area: chevron;
  58. width: 10px;
  59. height: 6px;
  60. fill: none;
  61. `;
  62. type ChevronIconProps = { $open: boolean };
  63. export const ChevronIcon = styled.path.attrs<ChevronIconProps>(({ $open }) => ({
  64. d: $open ? 'M8.99988 5L4.99988 1L0.999878 5' : 'M1 1L5 5L9 1',
  65. }))<ChevronIconProps>`
  66. stroke: ${({ theme }) => theme.menu.chevronIconColor};
  67. `;