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 | 4x 10x 4x 10x 4x 4x 3x 4x 10x 4x 60x | import styled, { css } from 'styled-components'; import media from 'styled-media-query'; import { ChevronRight } from '@styled-icons/fa-solid'; export const Container = styled.div` ${({ theme }) => css` background-color: ${theme.colors.primary}; display: flex; align-items: center; justify-content: center; border-radius: ${theme.border.radius} 0 0 ${theme.border.radius}; position: relative; transition: filter 0.2s; color: ${theme.colors.bg}; padding-inline: calc(${theme.spacings.xsmall}); width: 65%; ${media.greaterThan('small')` width: 50%; `} ${media.greaterThan('medium')` padding: 0 ${theme.spacings.small}; font-size: ${theme.font.sizes.large}; `} `} `; type InputProps = { isSelected: boolean; }; export const Input = styled.input<InputProps>` ${({ theme, isSelected }) => css` width: 100%; border: 0; background: none; text-transform: capitalize; font-size: ${theme.font.sizes.medium}; font-weight: ${theme.font.weights.medium}; color: inherit; ${isSelected && css` &::placeholder { color: inherit; } `} ${media.greaterThan('medium')` font-size: ${theme.font.sizes.large}; `} `} `; export const ChevronRightIcon = styled(ChevronRight)` width: 1.2rem; height: 1.2rem; position: relative; top: 2px; ${media.greaterThan('medium')` width: 1.6rem; height: 1.6rem; top: 4px; `} `; type DropdownProps = { open: boolean; }; const dropdownModifiers = { open: () => css` opacity: 1; transform: translateY(0); pointer-events: all; `, }; export const Dropdown = styled.div<DropdownProps>` ${({ theme, open }) => css` z-index: 50; position: absolute; left: 0; right: 0; top: calc(100% + ${theme.spacings.xsmall}); width: 100%; background: ${theme.colors.white}; border-radius: ${theme.border.radius}; border-style: solid; display: flex; flex-direction: column; overflow: auto; max-height: 20rem; opacity: 0; transform: translateY(10px); transition: 0.2s; pointer-events: none; &::-webkit-scrollbar-track { background: ${theme.colors.white}; border-radius: 0 ${theme.border.radius} ${theme.border.radius} 0; } &::-webkit-scrollbar-thumb { border-radius: 0 calc(${theme.border.radius} / 2) calc(${theme.border.radius} / 2) 0; } ${open && dropdownModifiers.open}; `} `; export const Option = styled.button` ${({ theme }) => css` flex-shrink: 0; width: 100%; padding: calc(${theme.spacings.xsmall} / 2) ${theme.spacings.xsmall}; cursor: pointer; text-transform: capitalize; font-size: ${theme.font.sizes.small}; background: ${theme.colors.white}; color: ${theme.colors.bg}; border: none; text-align: left; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; &:hover { filter: brightness(90%); } ${media.greaterThan('medium')` padding: ${theme.spacings.xsmall} ${theme.spacings.medium}; font-size: ${theme.font.sizes.medium}; `} `} `; |