Skip to content

Commit

Permalink
feat: article component
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbert committed Jul 11, 2021
1 parent 0551c5d commit 7e3a9c6
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/article/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Article
8 changes: 8 additions & 0 deletions components/article/bem.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @license EUPL-1.2
* Copyright (c) 2021 Robbert Broersma
*/

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

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

import "./bem.css";

import README from "./README.md";

export const Template = ({ content }) => `<div class="utrecht-article">${content}</div>`;

<Meta
title="Components/Article"
argTypes={{
content: {
description: "Content of the article",
control: "text",
},
}}
parameters={{
docs: {
transformSource: (_src, { args }) => Template(args),
},
status: {
type: "WORK IN PROGRESS",
},
notes: {
UX: README,
},
}}
/>

# Article

Styling via the `.utrecht-article` class name:

<Canvas>
<Story
name="Article"
args={{
content: `<h1>Lorem ipsum</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.</p>`,
}}
>
{Template.bind({})}
</Story>
</Canvas>

<ArgsTable story="Article" />
7 changes: 7 additions & 0 deletions components/article/block.style-dictionary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"utrecht": {
"article": {
"max-inline-size": {}
}
}
}
10 changes: 10 additions & 0 deletions components/article/html.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @license EUPL-1.2
* Copyright (c) 2021 Robbert Broersma
*/

@import "./bem";

.utrecht-html article {
@extend .utrecht-article;
}
53 changes: 53 additions & 0 deletions components/article/stencil.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!--
@license EUPL-1.2
Copyright (c) 2021 Robbert Broersma
-->

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

<!-- Import Docs -->

import README from "./README.md";

export const Template = ({ content }) => `<utrecht-article>${content}</utrecht-article>`;

<Meta
title="Web Component/Article"
argTypes={{
content: {
description: "Content of the article",
control: "text",
},
}}
parameters={{
docs: {
transformSource: (_src, { args }) => Template(args),
},
status: {
type: "WORK IN PROGRESS",
},
notes: {
UX: README,
},
}}
/>

# Article

<Canvas>
<Story
name="Article"
args={{
content: `<h1>Lorem ipsum</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.</p>`,
}}
>
{Template.bind({})}
</Story>
</Canvas>

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

@Component({
tag: "utrecht-article",
styleUrl: "bem.css",
shadow: true,
})
export class Article {
render() {
return (
<article class="utrecht-article">
<slot></slot>
</article>
);
}
}
1 change: 1 addition & 0 deletions components/html-content/html.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

/* Collection of all semantic HTML styles in the component library */

@import "../article/html";
@import "../blockquote/html";
@import "../button/html";
@import "../checkbox/html";
Expand Down
1 change: 1 addition & 0 deletions packages/component-library-css/src/html.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

/* Collection of all semantic HTML styles in the component library */

@import "../../../components/article/html";
@import "../../../components/blockquote/html";
@import "../../../components/form-label/html";
@import "../../../components/paragraph/html";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"utrecht": {
"article": {
"max-inline-size": {
"value": "780px"
}
}
}
}

0 comments on commit 7e3a9c6

Please sign in to comment.