-
Notifications
You must be signed in to change notification settings - Fork 0
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
3 changed files
with
91 additions
and
0 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,19 @@ | ||
diamond-app { | ||
display: grid; | ||
grid-template-areas: 'header' 'main' 'footer'; | ||
grid-template-columns: 1fr; | ||
grid-template-rows: auto 1fr auto; | ||
min-height: 100dvh; | ||
|
||
&::part(header) { | ||
grid-area: header; | ||
} | ||
|
||
&::part(main) { | ||
grid-area: main; | ||
} | ||
|
||
&::part(footer) { | ||
grid-area: footer; | ||
} | ||
} |
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,37 @@ | ||
import { StoryObj } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
|
||
export default { | ||
component: 'diamond-app', | ||
parameters: { | ||
layout: 'fullscreen', | ||
docs: { | ||
description: { | ||
component: | ||
'Wraps the whole site and provides slots for header, footer, and main content.', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const App: StoryObj = { | ||
render: () => html` | ||
<diamond-app> | ||
<diamond-section padding="lg" class="diamond-theme-medium" slot="header"> | ||
<diamond-wrap gutter="md"> | ||
<header>Header</header> | ||
</diamond-wrap> | ||
</diamond-section> | ||
<diamond-section padding="xl" class="diamond-theme-light"> | ||
<diamond-wrap gutter="md"> | ||
<main>Main</main> | ||
</diamond-wrap> | ||
</diamond-section> | ||
<diamond-section padding="lg" class="diamond-theme-dark" slot="footer"> | ||
<diamond-wrap gutter="md"> | ||
<footer>Footer</footer> | ||
</diamond-wrap> | ||
</diamond-section> | ||
</diamond-app> | ||
`, | ||
}; |
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,35 @@ | ||
import { LitElement, html } from 'lit'; | ||
import { customElement } from 'lit/decorators.js'; | ||
|
||
import { JSXCustomElement } from '../../../types/jsx-custom-element'; | ||
|
||
@customElement('diamond-app') | ||
export class App extends LitElement { | ||
render() { | ||
return html` | ||
<div part="header"> | ||
<slot name="header"></slot> | ||
</div> | ||
<div part="main"> | ||
<slot></slot> | ||
</div> | ||
<div part="footer"> | ||
<slot name="footer"></slot> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'diamond-app': App; | ||
} | ||
} | ||
|
||
declare module 'react' { | ||
namespace JSX { | ||
interface IntrinsicElements { | ||
'diamond-app': App & JSXCustomElement; | ||
} | ||
} | ||
} |