Skip to content

Commit

Permalink
feat: add a basic storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
megheaiulian committed Sep 22, 2020
1 parent 1b29c6a commit fc4a4f9
Show file tree
Hide file tree
Showing 9 changed files with 2,125 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
stories: ['../stories/**/*.stories.{js,mdx}'],
};
34 changes: 34 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
addParameters,
addDecorator,
setCustomElements,
withA11y,
} from '@open-wc/demoing-storybook';

addDecorator(withA11y);

addParameters({
a11y: {
config: {},
options: {
checks: { 'color-contrast': { options: { noScroll: true } } },
restoreScroll: true,
}
},
docs: {
iframeHeight: '400px',
},
options: {
enableShortcuts: false
}
});

async function run() {
const customElements = await (
await fetch('../custom-elements.json')
).json();

setCustomElements(customElements);
}

run();
41 changes: 41 additions & 0 deletions custom-elements.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": 2,
"tags": [
{
"name": "cosmoz-tabs",
"properties": [
{
"name": "selected",
"type": "String",
"description": "The name of the selected tab"
}
],
"events": [],
"slots": [
{
"name": "",
"description": "cosmoz-tab elements inside cosmoz-tabs get displayed when selected`"
}
],
"cssProperties": []
},
{
"name": "cosmoz-tab",
"properties": [
{
"name": "heading",
"type": "String",
"description": "The heading"
}
],
"events": [],
"slots": [
{
"name": "",
"description": "Content inside the cosmoz-tab"
}
],
"cssProperties": []
}
]
}
4 changes: 3 additions & 1 deletion lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const style = `
display: flex;
flex-direction: column;
font-family: var(--cosmoz-font-base, inherit);
font-size: 14px;
}
.tabs {
Expand All @@ -29,7 +30,8 @@ const style = `
color: inherit;
text-decoration: none;
text-align: center;
font-size: 1.14em;
font-size: 1.14285em;
line-height: 1.2;
font-weight: 300;
text-overflow: ellipsis;
white-space: nowrap;
Expand Down
Loading

0 comments on commit fc4a4f9

Please sign in to comment.