Skip to content

Commit

Permalink
feat: page header component
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbert committed Oct 11, 2021
1 parent 8530af7 commit df9befb
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/page-header/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Page Header
6 changes: 6 additions & 0 deletions components/page-header/bem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @license EUPL-1.2
* Copyright (c) 2021 Robbert Broersma
*/

export const PageHeader = ({ innerHTML = '' }) => `<header class="utrecht-page-header">${innerHTML}</header>`;
19 changes: 19 additions & 0 deletions components/page-header/bem.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license EUPL-1.2
* Copyright (c) 2021 Gemeente Utrecht
* Copyright (c) 2021 Robbert Broersma
*/

.utrecht-page-header {
background-color: var(--utrecht-page-header-background-color);
color: var(--utrecht-page-header-color);
grid-area: "utrecht-header";
padding-block-end: var(--utrecht-page-header-padding-block-end);
padding-block-start: var(--utrecht-page-header-padding-block-start);
padding-inline-end: var(--utrecht-page-padding-inline-end);
padding-inline-start: var(--utrecht-page-padding-inline-start);
}

.utrecht-page-header__content {
max-inline-size: var(--utrecht-page-max-inline-size);
}
39 changes: 39 additions & 0 deletions components/page-header/bem.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
@license EUPL-1.2
Copyright (c) 2021 Robbert Broersma
-->

import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs";
import { PageHeader } from "./bem";
import "./bem.scss";

<Meta
title="CSS Component/Page Header"
argTypes={{
innerHTML: {
description: "HTML content",
control: "text",
},
}}
parameters={{
docs: {
transformSource: (_src, { args }) => PageHeader(args),
},
status: "WORK IN PROGRESS",
}}
/>

# Page Header

<Canvas>
<Story
name="Page Header"
args={{
innerHTML: "Header content",
}}
>
{PageHeader.bind({})}
</Story>
</Canvas>

<ArgsTable story="Page Header" />
30 changes: 30 additions & 0 deletions components/page-header/block.tokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"utrecht": {
"page-header": {
"background-color": {
"css": {
"syntax": "<color>",
"inherits": true
}
},
"color": {
"css": {
"syntax": "<color>",
"inherits": true
}
},
"padding-start": {
"css": {
"syntax": "<length>",
"inherits": true
}
},
"padding-block-end": {
"css": {
"syntax": "<length>",
"inherits": true
}
}
}
}
}
12 changes: 12 additions & 0 deletions components/page-header/readme.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Description, Meta } from "@storybook/addon-docs";
import { ComponentTokensTable } from "../../documentation/components/ComponentTokensTable";
import tokens from "../../proprietary/design-tokens/dist/index.json";
import document from "./README.md";

<Meta title="CSS Component/Page Header/README" />

<Description>{document}</Description>

## Design Tokens

<ComponentTokensTable tokens={tokens} component="utrecht-page-header"></ComponentTokensTable>
14 changes: 14 additions & 0 deletions components/page-header/stencil.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @license EUPL-1.2
* Copyright (c) 2021 Robbert Broersma
*/

@import "./bem";

:host {
display: block;
}

:host([hidden]) {
display: none !important;
}
40 changes: 40 additions & 0 deletions components/page-header/stencil.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
@license EUPL-1.2
Copyright (c) 2021 Robbert Broersma
-->

import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs";
export const Template = ({ innerHTML = "" }) => `<utrecht-page-header>${innerHTML}</utrecht-page-header>`;

<Meta
title="Web Component/Page Header"
argTypes={{
innerHTML: {
description: "HTML content",
control: "text",
},
}}
parameters={{
docs: {
transformSource: (_src, { args }) => Template(args),
},
status: {
type: "WORK IN PROGRESS",
},
}}
/>

# Page Header

<Canvas>
<Story
name="Page Header"
args={{
innerHTML: "Header content",
}}
>
{Template.bind({})}
</Story>
</Canvas>

<ArgsTable story="Page Header" />
23 changes: 23 additions & 0 deletions components/page-header/stencil.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Component, h } from "@stencil/core";

/**
* @license EUPL-1.2
* Copyright (c) 2021 Gemeente Utrecht
*/

@Component({
tag: "utrecht-page-header",
styleUrl: "stencil.scss",
shadow: true,
})
export class PageHeader {
render() {
return (
<header class="utrecht-page-header">
<div class="utrecht-page-header__content">
<slot></slot>
</div>
</header>
);
}
}
2 changes: 2 additions & 0 deletions packages/web-component-library-angular/src/index.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
UtrechtPage,
UtrechtPageContent,
UtrechtPageFooter,
UtrechtPageHeader,
UtrechtPagination,
UtrechtParagraph,
UtrechtSeparator,
Expand Down Expand Up @@ -110,6 +111,7 @@ const components = [
UtrechtPage,
UtrechtPageContent,
UtrechtPageFooter,
UtrechtPageHeader,
UtrechtPagination,
UtrechtParagraph,
UtrechtSeparator,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"utrecht": {
"page-header": {
"padding-inline-end": { "value": "2.4em" },
"padding-inline-start": { "value": "2em" },
"padding-block-end": { "value": "1em" },
"padding-block-start": { "value": "1.8em" }
}
}
}

0 comments on commit df9befb

Please sign in to comment.