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.
Merge pull request #57 from deco-sites/feat/preview
add preview to layouts
- Loading branch information
Showing
7 changed files
with
738 additions
and
123 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
import { Section } from "deco/blocks/section.ts"; | ||
|
||
interface Props { | ||
children: Section; | ||
children?: Section; | ||
} | ||
|
||
function Container({ children }: Props) { | ||
if (!children) return null; | ||
|
||
return ( | ||
<div class="container"> | ||
<children.Component {...children.props} /> | ||
</div> | ||
); | ||
} | ||
|
||
export function Preview(props: Props) { | ||
if (props.children) { | ||
return <Container {...props} />; | ||
} | ||
|
||
return ( | ||
<div class="bg-primary bg-opacity-5 p-4"> | ||
<Container | ||
{...props} | ||
children={{ | ||
Component: () => ( | ||
<div class="rounded h-48 grid place-content-center w-full bg-base-100 text-base-300 text-sm"> | ||
Content | ||
</div> | ||
), | ||
props: {}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default Container; |
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
Oops, something went wrong.