All files / components/inputs/Select styled.tsx

80.95% Statements 17/21
50% Branches 4/8
66.66% Functions 8/12
80.95% Lines 17/21

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    1x     1x         1x   2x 2x                   1x   2x           1x 2x                 2x               1x 2x           2x     2x       1x                   1x                           1x  
/* eslint-disable no-ternary */
 
import styled from "styled-components"
import type { Theme } from "styles/theme"
 
export const Wrapper = styled.div`
  min-width: 150px;
  position: relative;
`
 
export const Control = styled.div`
  align-items: center;
  background: ${({ theme }: { theme: Theme }) => theme.palette.text.contrast};
  border: 1px solid ${({ theme }: { theme: Theme }) => theme.colors.gray.light};
  border-radius: 2px;
  column-gap: 20px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 20px;
  padding: 5px 10px 5px 16px;
  height: 44px;
`
 
export const DisplayValue = styled.label`
  color: ${({ $isSelected, theme }: { $isSelected: boolean; theme: Theme }) =>
    $isSelected ? theme.palette.text.main : theme.palette.text.light};
  font-size: 16px;
  font-weight: 400;
  margin: 0;
`
 
export const Label = styled.label<{ $isShrunk?: boolean }>`
  color: ${({ theme }: { theme: Theme }) => theme.palette.text.light};
  font-size: 16px;
  left: 16px;
  pointer-events: none;
  position: absolute;
  top: 8px;
  transition: all 200ms;
 
  ${({ $isShrunk }) =>
    $isShrunk &&
    `
    font-size: 12px;
    left: 16px;
    top: -24px;
  `}
`
 
export const Triangle = styled.div<{ $isOpen: boolean }>`
  border-color: ${({ theme }: { theme: Theme }) => theme.colors.gray.light};
  border-style: solid;
  border-width: 3.5px 3.5px 0 0;
  display: inline-block;
  height: 12px;
  position: relative;
  top: ${({ $isOpen }) => ($isOpen ? "2px" : "-2px")};
  width: 12px;
  transform: rotate(
    ${({ $isOpen }: { $isOpen: boolean }) => ($isOpen ? "-45deg" : "135deg")}
  );
`
 
export const Options = styled.ul`
  list-style: none;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  position: absolute;
  width: 100%;
  z-index: 10;
`
 
export const Option = styled.li`
  background: ${({ theme }: { theme: Theme }) => theme.palette.text.contrast};
  color: ${({ theme }: { theme: Theme }) => theme.palette.text.main};
  cursor: pointer;
  padding: 5px 10px;
  transition: 0.25s ease-in-out;
 
  &:hover {
    background: ${({ theme }: { theme: Theme }) => theme.palette.primary.main};
    color: ${({ theme }: { theme: Theme }) => theme.palette.primary.contrast};
    width: 100%;
  }
`
 
export const Input = styled.input.attrs({ type: "hidden" })``