Skip to content

Commit

Permalink
fixed theme provider
Browse files Browse the repository at this point in the history
  • Loading branch information
LiveDuo committed Sep 1, 2023
1 parent b5c8123 commit 565b886
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
14 changes: 8 additions & 6 deletions lib/client/craft/editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Container } from '../shared/Container'
import { loadTemplate, saveTemplateDebounce } from '../utils/fetch'
import PoweredBy from './PoweredBy'

import { ThemeContext } from '../store'
import { ThemeContext, ThemeProvider } from '../store'

interface FrameProps {
data: any
Expand All @@ -37,11 +37,13 @@ const FrameEditor: React.FC<FrameProps> = ({ data, standaloneServer }) => {
}, [])

return !data ? (
<Viewport>
<Frame>
<Element canvas is={Container} children={[]} custom={{ displayName: 'App' }} />
</Frame>
</Viewport>
<ThemeProvider standaloneServer={standaloneServer}>
<Viewport>
<Frame>
<Element canvas is={Container} children={[]} custom={{ displayName: 'App' }} />
</Frame>
</Viewport>
</ThemeProvider>
) : (
<div className="page-container">
<Frame />
Expand Down
10 changes: 3 additions & 7 deletions lib/client/craft/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React from 'react'

import Editor from './editor/Editor'

import { ThemeProvider } from './store'

import './styles/app.css'

interface ContentProviderBaseProps {
Expand All @@ -13,11 +11,9 @@ interface ContentProviderBaseProps {

const ContentProviderBase: React.FC<ContentProviderBaseProps> = ({ data, standaloneServer }) => {
return (
<ThemeProvider standaloneServer={standaloneServer}>
<div className="h-full h-screen">
<Editor data={data} standaloneServer={standaloneServer} />
</div>
</ThemeProvider>
<div className="h-full h-screen">
<Editor data={data} standaloneServer={standaloneServer} />
</div>
)
}

Expand Down

0 comments on commit 565b886

Please sign in to comment.