@@ -21,10 +21,12 @@ import {
2121 Text ,
2222} from "@chakra-ui/react"
2323import { BsThreeDots } from "@react-icons/all-files/bs/BsThreeDots"
24+ import { PiArrowLeft } from "@react-icons/all-files/pi/PiArrowLeft"
2425import { PiCaretDown } from "@react-icons/all-files/pi/PiCaretDown"
2526import { PiGlobe } from "@react-icons/all-files/pi/PiGlobe"
2627import { PiLock } from "@react-icons/all-files/pi/PiLock"
2728import { PiMagnifyingGlass } from "@react-icons/all-files/pi/PiMagnifyingGlass"
29+ import { PiPlus } from "@react-icons/all-files/pi/PiPlus"
2830import { PiPushPin } from "@react-icons/all-files/pi/PiPushPin"
2931import { PiPushPinFill } from "@react-icons/all-files/pi/PiPushPinFill"
3032import { 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