Skip to content

Commit

Permalink
Merge pull request #25 from etchteam/feature/etch-358-app
Browse files Browse the repository at this point in the history
feat: app
  • Loading branch information
mergify[bot] authored Feb 9, 2024
2 parents 88e5ed6 + 337ffe2 commit 55b7c5e
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
19 changes: 19 additions & 0 deletions components/composition/App/App.css
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;
}
}
37 changes: 37 additions & 0 deletions components/composition/App/App.stories.ts
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>
`,
};
35 changes: 35 additions & 0 deletions components/composition/App/App.ts
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;
}
}
}

0 comments on commit 55b7c5e

Please sign in to comment.