generated from deco-sites/start
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marcos Candeia <[email protected]>
- Loading branch information
Showing
7 changed files
with
162 additions
and
25 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,19 @@ | ||
import type { ComponentFunc } from "$live/engine/block.ts"; | ||
|
||
/** | ||
* @title The canonical props of a component. | ||
*/ | ||
export type CanonicalProps<T> = T & { | ||
Layout: ComponentFunc<T>; | ||
}; | ||
|
||
/** | ||
* The default implementation of a canonical component. | ||
* @param the canonical props | ||
*/ | ||
export function Canonical<TProps>( | ||
props: CanonicalProps<TProps>, | ||
) { | ||
const { Layout } = props; | ||
return <Layout {...props} />; | ||
} |
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,7 +1,7 @@ | ||
{ | ||
"imports": { | ||
"deco-sites/std/": "./", | ||
"$live/": "https://denopkg.com/deco-cx/live@1.4.4/", | ||
"$live/": "https://denopkg.com/deco-cx/live@acd4cddd20437b64c4253d3c4c84face77718347/", | ||
"partytown/": "https://deno.land/x/[email protected]/", | ||
"$fresh/": "https://denopkg.com/deco-cx/[email protected]/", | ||
"preact": "https://esm.sh/[email protected]", | ||
|
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { | ||
Layout, | ||
Props as HeaderProps, | ||
} from "deco-sites/std/sections/Header.tsx"; | ||
|
||
function MyHeaderLayout({ logo }: HeaderProps) { | ||
return <div>This is a {logo}</div>; | ||
} | ||
|
||
export default function MyHeader(): Layout { | ||
return MyHeaderLayout; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { ComponentFunc } from "$live/engine/block.ts"; | ||
import { Canonical } from "deco-sites/std/commerce/types.tsx"; | ||
|
||
export type Layout = ComponentFunc<Props>; | ||
|
||
export interface Props { | ||
logo: string; | ||
Layout: Layout; | ||
} | ||
|
||
export default function Header(props: Props) { | ||
return <Canonical {...props} />; | ||
} |