Skip to content

Commit 4f211d2

Browse files
committed
feat: ui fixes for created by filter
1 parent 96b912e commit 4f211d2

2 files changed

Lines changed: 43 additions & 22 deletions

File tree

packages/imagekit-editor-dev/src/components/common/MultiSelectListField.tsx

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,16 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
8181
}, [options, query, safeValue, selectedFirst])
8282

8383
const shouldRenderSeparator =
84-
selectedFirst && showSelectedSeparator && selected.length > 0 && other.length > 0
85-
86-
const renderOption = (opt: MultiSelectListOption, idx: number, arrLen: number) => {
84+
selectedFirst &&
85+
showSelectedSeparator &&
86+
selected.length > 0 &&
87+
other.length > 0
88+
89+
const renderOption = (
90+
opt: MultiSelectListOption,
91+
idx: number,
92+
arrLen: number,
93+
) => {
8794
const isChecked = safeValue.includes(opt.value)
8895
const disabled = opt.isDisabled
8996

@@ -92,7 +99,8 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
9299
key={opt.value}
93100
px="3"
94101
py="2.5"
95-
spacing="3"
102+
spacing="2"
103+
alignItems="center"
96104
cursor={disabled ? "not-allowed" : "pointer"}
97105
opacity={disabled ? 0.5 : 1}
98106
onClick={() => {
@@ -104,6 +112,7 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
104112
borderBottomWidth={idx < arrLen - 1 ? "1px" : "0"}
105113
borderBottomColor="gray.100"
106114
transition="background-color 0.12s ease-in-out"
115+
margin="2"
107116
>
108117
<Checkbox
109118
isChecked={isChecked}
@@ -113,14 +122,12 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
113122
}}
114123
pointerEvents="none"
115124
flexShrink={0}
125+
borderColor="gray.300"
126+
bg="white"
127+
mr="2"
116128
/>
117129

118-
<Avatar
119-
size="xs"
120-
name={opt.label}
121-
src={opt.avatar}
122-
flexShrink={0}
123-
/>
130+
<Avatar size="xs" name={opt.label} src={opt.avatar} flexShrink={0} />
124131

125132
<Flex direction="column" minW={0} flex="1">
126133
<Text fontSize="sm" fontWeight="500" noOfLines={1}>
@@ -136,7 +143,9 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
136143
)
137144
}
138145

139-
const renderedCount = selectedFirst ? selected.length + other.length : selected.length
146+
const renderedCount = selectedFirst
147+
? selected.length + other.length
148+
: selected.length
140149

141150
return (
142151
<Box
@@ -148,17 +157,20 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
148157
bg="transparent"
149158
>
150159
{isSearchable ? (
151-
<Box px="3" py="2.5" borderBottomWidth="1px" borderBottomColor="gray.100">
152-
<InputGroup size="sm">
153-
<InputLeftElement pointerEvents="none">
154-
<Icon as={PiMagnifyingGlass} color="gray.400" boxSize={4} />
155-
</InputLeftElement>
160+
<Box
161+
px="4"
162+
py="2.5"
163+
borderBottomWidth="1px"
164+
borderBottomColor="gray.100"
165+
>
166+
<Flex alignItems="center" gap="2">
167+
<Icon as={PiMagnifyingGlass} color="gray.400" boxSize={4} />
156168
<Input
169+
fontSize="sm"
157170
placeholder={searchPlaceholder}
158171
value={query}
159172
onChange={(e) => setQuery(e.target.value)}
160173
variant="unstyled"
161-
pl="8"
162174
bg="transparent"
163175
borderColor="transparent"
164176
_hover={{ borderColor: "transparent" }}
@@ -167,14 +179,16 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
167179
boxShadow: "none",
168180
}}
169181
/>
170-
</InputGroup>
182+
</Flex>
171183
</Box>
172184
) : null}
173185

174186
<Box overflowY="auto" maxH={maxHeight}>
175187
{selectedFirst ? (
176188
<>
177-
{selected.map((opt, idx) => renderOption(opt, idx, selected.length))}
189+
{selected.map((opt, idx) =>
190+
renderOption(opt, idx, selected.length),
191+
)}
178192
{shouldRenderSeparator ? <Divider borderColor="gray.200" /> : null}
179193
{other.map((opt, idx) => renderOption(opt, idx, other.length))}
180194
</>
@@ -184,7 +198,9 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
184198

185199
{renderedCount === 0 && (
186200
<Flex align="center" justify="center" px="3" py="8" color="gray.500">
187-
<Text fontSize="sm">{query.trim() ? "No matches found" : "No items available"}</Text>
201+
<Text fontSize="sm">
202+
{query.trim() ? "No matches found" : "No items available"}
203+
</Text>
188204
</Flex>
189205
)}
190206
</Box>

packages/imagekit-editor-dev/src/components/templates/TemplatesLibraryView.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,12 @@ export function TemplatesLibraryView({ onClose }: Props) {
286286
p="0"
287287
outline="none"
288288
boxShadow="md"
289-
_focus={{ outline: "none", boxShadow: "md" }}
289+
borderWidth="0"
290+
_focus={{
291+
outline: "none",
292+
boxShadow: "md",
293+
borderColor: "transparent",
294+
}}
290295
>
291296
<PopoverBody p="0" display="flex" flexDirection="column">
292297
<MultiSelectListField
@@ -301,7 +306,7 @@ export function TemplatesLibraryView({ onClose }: Props) {
301306
selectedFirst
302307
showSelectedSeparator
303308
/>
304-
<Divider my="0" />
309+
<Divider alignSelf="center" my="0" borderColor="gray.200" />
305310
<Button
306311
w="full"
307312
variant="ghost"

0 commit comments

Comments
 (0)