generated from deco-sites/fashion
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useContext } from "preact/hooks"; | ||
import { createContext } from "preact"; | ||
|
||
export const LayoutContext = createContext({ isPreview: false }); | ||
|
||
export const useLayoutContext = () => useContext(LayoutContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
import { Section } from "deco/blocks/section.ts"; | ||
import { LayoutContext } from "$store/components/Layout.tsx"; | ||
|
||
interface Props { | ||
children: Section; | ||
} | ||
|
||
function Gallery({ children: { Component, props } }: Props) { | ||
function Section({ children: { Component, props } }: Props) { | ||
return ( | ||
<> | ||
<Component {...props} /> | ||
</> | ||
); | ||
} | ||
|
||
export default Gallery; | ||
export function Preview(props: Props) { | ||
return ( | ||
<LayoutContext.Provider value={{ isPreview: true }}> | ||
<Section {...props} /> | ||
</LayoutContext.Provider> | ||
); | ||
} | ||
|
||
export default Section; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6936111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An internal server error occurred.
6936111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An internal server error occurred.