styles.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import styled, { DefaultTheme } from "styled-components";
  2. function getTypeColor(value: string, theme: DefaultTheme) {
  3. if (!Number.isNaN(+value)) return "#FD0079";
  4. if (value === "true") return theme.TEXT_POSITIVE;
  5. if (value === "false") return theme.TEXT_DANGER;
  6. }
  7. export const StyledTextWrapper = styled.div`
  8. display: flex;
  9. justify-content: center;
  10. align-items: center;
  11. font-size: 12px;
  12. width: 100%;
  13. height: 100%;
  14. overflow: hidden;
  15. cursor: pointer;
  16. `;
  17. export const StyledText = styled.pre<{ width: number; height: number }>`
  18. display: flex;
  19. justify-content: center;
  20. flex-direction: column;
  21. width: ${({ width }) => width};
  22. height: ${({ height }) => height};
  23. min-height: 50;
  24. color: ${({ theme }) => theme.TEXT_NORMAL};
  25. `;
  26. export const StyledForeignObject = styled.foreignObject`
  27. pointer-events: none;
  28. * {
  29. font-family: "Roboto Mono", monospace;
  30. }
  31. &.searched {
  32. border: 2px solid ${({ theme }) => theme.TEXT_POSITIVE};
  33. border-radius: 2px;
  34. }
  35. .highlight {
  36. background-color: rgba(255, 0, 255, 0.5);
  37. filter: hue-rotate();
  38. }
  39. .renderVisible {
  40. display: flex;
  41. justify-content: center;
  42. align-items: center;
  43. font-size: 12px;
  44. width: 100%;
  45. height: 100%;
  46. overflow: hidden;
  47. cursor: pointer;
  48. }
  49. `;
  50. export const StyledKey = styled.span<{
  51. objectKey?: boolean;
  52. parent?: boolean;
  53. }>`
  54. font-weight: 500;
  55. color: ${({ theme, objectKey, parent }) =>
  56. parent
  57. ? theme.NODE_KEY
  58. : objectKey
  59. ? theme.OBJECT_KEY
  60. : theme.TEXT_POSITIVE};
  61. font-size: ${({ parent }) => parent && "14px"};
  62. `;
  63. export const StyledRow = styled.span<{ width: number; value: string }>`
  64. height: 18px;
  65. overflow: hidden;
  66. text-overflow: ellipsis;
  67. white-space: nowrap;
  68. padding: 0 auto;
  69. width: ${({ width }) => `${width - 20}px`};
  70. color: ${({ theme, value }) => getTypeColor(value, theme)};
  71. `;