Skip to content

Commit cf0e151

Browse files
committed
feat: polished template library ui blocks
1 parent 8c637d2 commit cf0e151

3 files changed

Lines changed: 44 additions & 26 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
130130
<Avatar size="xs" name={opt.label} src={opt.avatar} flexShrink={0} />
131131

132132
<Flex direction="column" minW={0} flex="1">
133-
<Text fontSize="sm" fontWeight="500" noOfLines={1}>
133+
<Text fontSize="sm" fontWeight="500" noOfLines={1} color="gray.600">
134134
{opt.label}
135135
</Text>
136136
{opt.email && (

packages/imagekit-editor-dev/src/components/editor/layout.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Box, Flex, IconButton } from "@chakra-ui/react"
2-
import { PiX } from "@react-icons/all-files/pi/PiX"
1+
import { Box, Flex } from "@chakra-ui/react"
32
import { useEffect, useState } from "react"
43
import { useAutoSaveTemplate } from "../../hooks/useAutoSaveTemplate"
54
import { useSaveTemplate } from "../../hooks/useSaveTemplate"
@@ -89,17 +88,6 @@ export function EditorLayout({ onAddImage, onClose, exportOptions }: Props) {
8988
flexDirection="column"
9089
position="relative"
9190
>
92-
<IconButton
93-
aria-label="Close templates"
94-
icon={<PiX />}
95-
size="sm"
96-
variant="ghost"
97-
position="absolute"
98-
top="3"
99-
right="3"
100-
zIndex={1}
101-
onClick={() => setIsTemplatesOpen(false)}
102-
/>
10391
<Box
10492
flex="1 1 0"
10593
minH={0}

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

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ import {
2121
Text,
2222
} from "@chakra-ui/react"
2323
import { BsThreeDots } from "@react-icons/all-files/bs/BsThreeDots"
24+
import { PiArrowLeft } from "@react-icons/all-files/pi/PiArrowLeft"
2425
import { PiCaretDown } from "@react-icons/all-files/pi/PiCaretDown"
2526
import { PiGlobe } from "@react-icons/all-files/pi/PiGlobe"
2627
import { PiLock } from "@react-icons/all-files/pi/PiLock"
2728
import { PiMagnifyingGlass } from "@react-icons/all-files/pi/PiMagnifyingGlass"
29+
import { PiPlus } from "@react-icons/all-files/pi/PiPlus"
2830
import { PiPushPin } from "@react-icons/all-files/pi/PiPushPin"
2931
import { PiPushPinFill } from "@react-icons/all-files/pi/PiPushPinFill"
3032
import { PiTrash } from "@react-icons/all-files/pi/PiTrash"
@@ -61,7 +63,8 @@ export function TemplatesLibraryView({ onClose }: Props) {
6163
const [creatorFilter, setCreatorFilter] = useState<string[]>([])
6264
const [pinningId, setPinningId] = useState<string | null>(null)
6365

64-
const { loadTemplate, setTemplateName, setTemplateId } = useEditorStore()
66+
const { loadTemplate, setTemplateName, setTemplateId, resetToNewTemplate } =
67+
useEditorStore()
6568
const templateId = useEditorStore((s) => s.templateId)
6669
const templateName = useEditorStore((s) => s.templateName)
6770
const transformations = useEditorStore((s) => s.transformations)
@@ -209,18 +212,45 @@ export function TemplatesLibraryView({ onClose }: Props) {
209212
flexDirection="column"
210213
gap="4"
211214
>
212-
<Box>
213-
<Text
214-
fontSize="lg"
215-
fontWeight="semibold"
216-
color="editorBattleshipGrey.900"
215+
<Button
216+
onClick={onClose}
217+
variant="ghost"
218+
size="xs"
219+
alignSelf="flex-start"
220+
leftIcon={<Icon as={PiArrowLeft} boxSize={4} />}
221+
color="editorBattleshipGrey.500"
222+
_hover={{ color: "editorBattleshipGrey.700", bg: "transparent" }}
223+
px="0"
224+
>
225+
Go back
226+
</Button>
227+
228+
<Flex alignItems="center" justifyContent="space-between">
229+
<Box>
230+
<Text
231+
fontSize="lg"
232+
fontWeight="semibold"
233+
color="editorBattleshipGrey.900"
234+
>
235+
All templates
236+
</Text>
237+
<Text fontSize="sm" color="editorBattleshipGrey.500">
238+
Browse and load templates created by you or shared with you.
239+
</Text>
240+
</Box>
241+
<Button
242+
size="md"
243+
colorScheme="blue"
244+
leftIcon={<Icon as={PiPlus} boxSize={4} />}
245+
px="4"
246+
onClick={() => {
247+
resetToNewTemplate()
248+
onClose()
249+
}}
217250
>
218-
All templates
219-
</Text>
220-
<Text fontSize="sm" color="editorBattleshipGrey.500">
221-
Browse and load templates shared with you or created by your team.
222-
</Text>
223-
</Box>
251+
New template
252+
</Button>
253+
</Flex>
224254

225255
{/* Controls bar */}
226256
<Flex

0 commit comments

Comments
 (0)