Skip to content

Commit

Permalink
chore: use definition from components
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Jun 25, 2024
1 parent f202567 commit c65a5f2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
15 changes: 8 additions & 7 deletions apps/studio/src/contexts/EditorDrawerContext.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { type IsomerComponent } from '@opengovsg/isomer-components'
import React, {
createContext,
useState,
useContext,
useMemo,
type PropsWithChildren,
} from 'react'
import { type Block, type DrawerState } from '~/types/editorDrawer'
import { type DrawerState } from '~/types/editorDrawer'

export interface DrawerContextType {
drawerState: DrawerState
setDrawerState: (state: DrawerState) => void
pageState: Block[]
setPageState: (state: Block[]) => void
editorState: Block[]
setEditorState: (state: Block[]) => void
pageState: IsomerComponent[]
setPageState: (state: IsomerComponent[]) => void
editorState: IsomerComponent[]
setEditorState: (state: IsomerComponent[]) => void
}
const EditorDrawerContext = createContext<DrawerContextType | null>(null)

Expand All @@ -22,9 +23,9 @@ export function EditorDrawerProvider({ children }: PropsWithChildren) {
state: 'root',
})
// Current saved state of page
const [pageState, setPageState] = useState<Block[]>([])
const [pageState, setPageState] = useState<IsomerComponent[]>([])
// Current edit view of page
const [editorState, setEditorState] = useState<Block[]>([])
const [editorState, setEditorState] = useState<IsomerComponent[]>([])

const value = useMemo(
() => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface PreviewProps {
version: string
layout: string
page: any
content: IsomerPageSchema['content']
content: IsomerComponent
}
}

Expand Down
5 changes: 0 additions & 5 deletions apps/studio/src/types/editorDrawer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
export type Block = {
text: string
id: string
}

export type RootDrawerState = {
state: 'root'
}
Expand Down

0 comments on commit c65a5f2

Please sign in to comment.