layout.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { CSSProperties } from 'react';
  2. import styled from 'styled-components';
  3. import { colors } from './variables';
  4. export const FlexRow = styled.div`
  5. display: flex;
  6. `;
  7. export const FlexColumn = styled(FlexRow)`
  8. flex-flow: column;
  9. `;
  10. export const NoWrapFill = styled.span`
  11. overflow: hidden;
  12. text-overflow: ellipsis;
  13. width: 100%;
  14. `;
  15. export const NoWrap = styled.div`
  16. white-space: nowrap;
  17. `;
  18. export type ActiveHighlightRowProps = {
  19. active?: boolean;
  20. highlight?: boolean;
  21. parentActive?: boolean;
  22. };
  23. export const ActiveHighlightRow = styled(FlexRow)<ActiveHighlightRowProps>`
  24. background: ${({ active, parentActive }): string => {
  25. if (active) {
  26. if (parentActive) {
  27. return colors.selected.background;
  28. }
  29. return colors.selected.inactive;
  30. }
  31. return 'none';
  32. }};
  33. color: ${({ active, highlight, parentActive }): string => {
  34. if (highlight) {
  35. if (active && !parentActive) {
  36. return colors.active.parentInactive;
  37. }
  38. return colors.active.color;
  39. }
  40. if (active && !parentActive) {
  41. return colors.background;
  42. }
  43. return colors.foreground;
  44. }};
  45. font-weight: ${({ active, highlight }): CSSProperties['fontWeight'] =>
  46. active || highlight ? 'bold' : 'normal'};
  47. white-space: nowrap;
  48. width: 100%;
  49. `;
  50. export const FlexList = styled(FlexColumn)`
  51. min-width: 0;
  52. * {
  53. &::-webkit-scrollbar {
  54. display: none;
  55. }
  56. scrollbar-width: none;
  57. -ms-overflow-style: none;
  58. }
  59. `;