Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] - Migrate examples and documentation to Storybook #127

Open
wants to merge 36 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a0fdee6
Add storybook with initial config
thiagothimoteo Aug 4, 2020
7a36a2c
Add storybook docs addon
thiagothimoteo Aug 5, 2020
87f9119
Add copy-code-block dependency
thiagothimoteo Aug 5, 2020
ffbd115
Add get started docs
thiagothimoteo Aug 5, 2020
4dbef15
create parseToCodeBlock helper
thiagothimoteo Aug 5, 2020
d4f7389
Improve buttons examples
thiagothimoteo Aug 5, 2020
a32b2c4
Add alert component to storybook
thiagothimoteo Aug 5, 2020
eaf9a57
Add avatar component to storybook
thiagothimoteo Aug 5, 2020
5e45512
Refactor template insertion
thiagothimoteo Aug 5, 2020
6f12c3b
Re-organize components stories
thiagothimoteo Aug 5, 2020
304548a
Add title story
thiagothimoteo Aug 5, 2020
161441a
Add table story
thiagothimoteo Aug 5, 2020
35ad0f7
Add breadcrumb story
thiagothimoteo Aug 5, 2020
01669f2
Add pagination story
thiagothimoteo Aug 5, 2020
61259e4
Add modal story
thiagothimoteo Aug 5, 2020
0bdc201
Fix modal story classes
thiagothimoteo Aug 5, 2020
08c0a3b
Added tag stories
ThawanFidelis Aug 5, 2020
bd937da
Added chameleon icon and base theme
ThawanFidelis Aug 5, 2020
3fd11f8
Added card stories
ThawanFidelis Aug 5, 2020
7a54773
Add input story
thiagothimoteo Aug 6, 2020
98f253d
Add checkbox, radio, textarea stories
thiagothimoteo Aug 6, 2020
e63ee93
Add helper to format class names
thiagothimoteo Aug 6, 2020
12efed3
Merge branch 'storybook' of github.com:myfreecomm/chameleon into stor…
thiagothimoteo Aug 6, 2020
1f7c073
Add select story
thiagothimoteo Aug 6, 2020
cb36704
Add blankslate story
thiagothimoteo Aug 6, 2020
e96ffb8
Add viewport addon
thiagothimoteo Aug 7, 2020
8edd6f5
Add grid story
thiagothimoteo Aug 7, 2020
b8ac702
Add brand story
thiagothimoteo Aug 7, 2020
fcf4b65
Draft a documentation pattern
thiagothimoteo Aug 7, 2020
84f7437
Refactor avatar, brand, breadcrumb, alert stories
thiagothimoteo Aug 10, 2020
0794c80
Refactor button story
thiagothimoteo Aug 10, 2020
21855b3
Refactor card, checkbox, input, radio, select stories
thiagothimoteo Aug 10, 2020
ebf3634
Refactor modal, pagination, table, tag stories
thiagothimoteo Aug 10, 2020
cb5f58c
Refactor textarea story
thiagothimoteo Aug 10, 2020
08b30b1
Refactor title story
thiagothimoteo Aug 10, 2020
5e932b3
Refactor layouts stories
thiagothimoteo Aug 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .storybook/chameleonTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { create } from '@storybook/theming/create';

export default create({
base: 'light',

brandTitle: 'Chameleon',
brandUrl: 'https://github.com/myfreecomm/chameleon',
brandImage: 'https://user-images.githubusercontent.com/6816187/89459602-480dd900-d73f-11ea-8a33-2d6e8555237d.png',
});
1 change: 1 addition & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '!style-loader!css-loader!sass-loader!./scss-loader.scss'
67 changes: 67 additions & 0 deletions .storybook/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import copyCodeBlock from '@pickra/copy-code-block'

import hljs from 'highlight.js/lib/highlight'
import xml from 'highlight.js/lib/languages/xml'
hljs.registerLanguage('html', xml)

const codeBlockOptions = {
lang: 'html',
colors: {
background: '#222',
textColor: '#fff',
attr: '#fab',
string: '#abe',
tag: '#afa',
name: '#ea8'
},
cssOverrides: `
.container {
position: relative;
padding: 2em;
align-items: center;
}

.container pre {
max-width: 100%;
}

.container button {
position: absolute;
bottom: -1px;
right: -1px;
padding: 3px 5px;
font-size: 12px;
font-weight: bold;
color: #999;
background-color: #eee !important;
border-radius: 4px 0 0 0;
outline: 0;
}

.container button:hover {
color: #666;
}

.container code {
padding-bottom: 0;
}
`
}

export const parseToCodeBlock = (block) => {
return copyCodeBlock(block, codeBlockOptions)
}

export const insertTemplateOnContainer = (block) => `
<div style="padding: 2rem">
<h1 class="ch-title ch-title--1">Playground</h1>

<br />

${block}
</div>
`

export const formatClassNames = (str) => {
return str.trim().replace(/ +(?= )/g,'');
}
8 changes: 8 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
stories: ['../stories/**/*.stories.@(js|mdx)'],
addons: [
'@storybook/addon-knobs/register',
'@storybook/addon-docs',
'@storybook/addon-viewport/register'
]
};
6 changes: 6 additions & 0 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addons } from '@storybook/addons';
import chameleonTheme from './chameleonTheme';

addons.setConfig({
theme: chameleonTheme,
});
3 changes: 3 additions & 0 deletions .storybook/scss-loader.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import url('https://fonts.googleapis.com/css?family=Montserrat:600|Nunito+Sans:300,400,600,700&display=swap');
@import url('https://s3-us-west-2.amazonaws.com/nexaas-chameleon/fontawesome/v5.3.1/css/all.min.css');
@import '../scss';
Loading