All files / src/components/ui/lists style.ts

0% Statements 0/23
0% Branches 0/10
0% Functions 0/13
0% Lines 0/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146                                                                                                                                                                                                                                                                                                   
import styled, { css } from "styled-components";
 
// #region EntityListItem
 
interface StyledEntityListItemProps {
  $nestLevel?: number;
  $isOver?: boolean;
}
 
interface StyledNavigatorArrowProps {
  $open: boolean;
}
 
interface StyledEntityLabelColorProps {
  $color: string;
}
 
export const StyledEntityListItem = styled.div<StyledEntityListItemProps>`
  display: flex;
  align-items: center;
  text-overflow: ellipsis;
  overflow: hidden;
  width: 100%;
  color: ${(props) => props.theme.colors.list.text};
  padding-left: ${(props) => (props.$nestLevel || 0) * 15}px;
 
  ${(props) =>
    props.$isOver &&
    css`
      background: ${(props) => props.theme.colors.list.selectedBackground};
      outline: 5px solid
        ${(props) => props.theme.colors.list.selectedBackground};
    `}
`;
 
export const StyledNavigatorArrow = styled.span<StyledNavigatorArrowProps>`
  display: inline-flex;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  margin-left: -5px;
 
  svg {
    fill: ${(props) => props.theme.colors.list.text};
    width: 8px;
    height: 8px;
    transform: rotate(${(props) => (props.$open ? 90 : 0)}deg);
  }
`;
 
export const StyledEntityIcon = styled.div`
  svg {
    fill: ${(props) => props.theme.colors.list.icon};
    width: 10px;
    height: 10px;
    margin-right: 5px;
  }
`;
 
export const StyledEntityLabel = styled.div`
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
`;
 
export const StyledEntityWarningLabel = styled.span`
  color: red;
`;
 
export const StyledEntityLabelColor = styled.div.attrs<StyledEntityLabelColorProps>(
  (props) => ({
    className: `label--${props.$color}`,
  }),
)`
  width: 10px;
  height: 10px;
  border-radius: 10px;
  flex-shrink: 0;
  margin-left: 5px;
`;
 
// #endregion EntityListItem
 
// #region SortableList
 
interface StyledSortableListProps {
  $orientation?: "horizontal" | "vertical";
  $gap: number;
  $padding: number;
}
 
export const StyledSortableList = styled.div<StyledSortableListProps>`
  display: flex;
  gap: ${(props) => props.$gap}px;
  padding: ${(props) => props.$padding}px;
  ${(props) =>
    props.$orientation === "vertical"
      ? css`
          flex-direction: column;
          overflow: auto;
          max-width: 100%;
          max-height: 100%;
          overflow-y: scroll;
          overflow-y: auto;
        `
      : css`
          overflow: auto;
          max-width: 100%;
          max-height: 100%;
          overflow-x: scroll;
          overflow-x: auto;
        `};
 
  & > * {
    flex-shrink: 0;
  }
`;
 
// #endregion SortableList
 
// #region ListWithDropzone
 
export const StyledListWithDropzoneWrapper = styled.div`
  display: flex;
  flex-direction: column;
`;
 
interface StyledListDropzoneProps {
  $isOver?: boolean;
}
 
export const StyledListDropzone = styled.div<StyledListDropzoneProps>`
  flex-grow: 1;
 
  ${(props) =>
    props.$isOver &&
    css`
      background: ${props.theme.colors.list.selectedBackground};
    `}
`;
 
// #endregion ListWithDropzone