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

docs: storybook upgrade & renovation #506

Merged
merged 238 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
9d352ba
chore: bump storybook to 6.1.14
KaiVandivier Jan 21, 2021
b5088f3
feat: add essential-addons
KaiVandivier Jan 21, 2021
ec5c800
chore: add storybook dev script
KaiVandivier Jan 21, 2021
94a2114
style: add DHIS 2 favicon to storybook
KaiVandivier Jan 21, 2021
7a32ee9
style: add DHIS 2 theming to storybook
KaiVandivier Jan 21, 2021
6d62191
docs(storybook): add a11y addon
KaiVandivier Jan 25, 2021
babff10
chore(storybook): add explanation about loading static files
KaiVandivier Jan 25, 2021
d4d92d6
chore(storybook): clarify comments
KaiVandivier Jan 25, 2021
1295621
chore(storybook): add description of font theming
KaiVandivier Jan 27, 2021
1fdf449
docs(storybook): update Button to new features
KaiVandivier Jan 27, 2021
8939b24
docs(storybook): migrate storiesOf to CSF
KaiVandivier Jan 27, 2021
6ddd7c7
docs(storybook): escape string for react
KaiVandivier Jan 27, 2021
a0ccd70
docs(storybook): add Card component for args table
KaiVandivier Jan 28, 2021
2dd4d03
refactor: use react prop types library
KaiVandivier Jan 28, 2021
e1c1f40
refactor: reorganize default callbacks for use in storybook
KaiVandivier Jan 28, 2021
9bed681
docs(storybook): workaround for defaultProps problem
KaiVandivier Jan 28, 2021
23731a5
refactor: use react prop-types
KaiVandivier Jan 28, 2021
62cdeeb
docs(storybook): add component for args table
KaiVandivier Jan 28, 2021
23e43f3
refactor: use react prop-types library
KaiVandivier Jan 29, 2021
b6e3298
refactor: use react prop-types library
KaiVandivier Jan 29, 2021
83261df
fix: prop type error for just one child
KaiVandivier Jan 29, 2021
61dae68
docs(storybook): render in iframe to account for portal
KaiVandivier Jan 29, 2021
cf36bb7
docs(storybook): use iframes to fix portal issue
KaiVandivier Jan 29, 2021
7bc5fb0
docs(storybook): organize components into hierarchy
KaiVandivier Jan 29, 2021
e136334
docs(storybook): hoist story annotations
KaiVandivier Jan 29, 2021
5e6091a
refactor: use react prop-types library
KaiVandivier Jan 31, 2021
0543c22
docs(storybook): add custom arg types
KaiVandivier Jan 31, 2021
546c78e
docs(storybook): add custom arg types for args tables
KaiVandivier Jan 31, 2021
8e93751
docs(storybook): apply custom arg types to variant and size
KaiVandivier Jan 31, 2021
aabf381
docs(storybook): use docs.description.component to annotate
KaiVandivier Jan 31, 2021
de6ee33
refactor: use react prop-types lib
KaiVandivier Jan 31, 2021
c42b1df
docs(storybook): add some prop type annotations
KaiVandivier Jan 31, 2021
ab0c525
docs(storybook): add annotations and custom argtypes
KaiVandivier Jan 31, 2021
c81cd34
docs(storybook): add description
KaiVandivier Jan 31, 2021
fe028d3
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
8cd06dc
docs(storybook): add description, use args for stories
KaiVandivier Feb 1, 2021
22f72c2
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
7045583
docs: add prop annotations
KaiVandivier Feb 1, 2021
838928d
docs: description, enable controls, arg types
KaiVandivier Feb 1, 2021
ebc3b61
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
132303b
docs: description, story, example
KaiVandivier Feb 1, 2021
4b3613b
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
0cc938c
docs: description, wrapper, args
KaiVandivier Feb 1, 2021
950c6dc
docs: fix link location
KaiVandivier Feb 1, 2021
854e5c3
docs: fix statusArgType properties
KaiVandivier Feb 1, 2021
4c8023e
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
810b12a
docs: description, args, templates, stories
KaiVandivier Feb 1, 2021
b41a793
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
4c0bc1d
docs: description, args, stories, template
KaiVandivier Feb 1, 2021
c7b26c4
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
c4c47d5
docs: description, args
KaiVandivier Feb 1, 2021
668baf9
docs: shorten subtitle
KaiVandivier Feb 1, 2021
ac6f4a1
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
ca99c9e
docs: description, args, stories
KaiVandivier Feb 1, 2021
a42a1ff
refactor: use react prop-types lib
KaiVandivier Feb 1, 2021
f8f8e5c
docs: description, template, args for ComponentCover
KaiVandivier Feb 1, 2021
c67cc3a
docs: description, args for CssReset
KaiVandivier Feb 1, 2021
fad9832
refactor: use react prop-types lib for CssVariables
KaiVandivier Feb 1, 2021
e254fac
docs: description, args for CssVariables
KaiVandivier Feb 1, 2021
ca6530d
refactor: use react prop-types lib for Divider
KaiVandivier Feb 1, 2021
61a5d43
docs: description, template, args for Divider
KaiVandivier Feb 1, 2021
71bb205
refactor: use react prop-types lib for DropdownButton
KaiVandivier Feb 1, 2021
011faf0
docs: description, template, stories for DropdownButton
KaiVandivier Feb 1, 2021
c1f6f15
refactor: prop annotations and prop-types for Field
KaiVandivier Feb 1, 2021
45e8dca
docs: description, args, story for Field
KaiVandivier Feb 1, 2021
d10a8b7
refactor: react prop-types lib for FieldSet
KaiVandivier Feb 1, 2021
6787b0d
docs: description, args for FieldSet
KaiVandivier Feb 1, 2021
ac0dbcd
refactor: prop-types lib for FileInput (and annotations)
KaiVandivier Feb 1, 2021
8fb7d42
docs: description, args, stories for FileInput
KaiVandivier Feb 1, 2021
b56bebd
refactor: prop-types lib and annotations
KaiVandivier Feb 1, 2021
1489b5a
docs: description, args, stories for FlyoutMenu
KaiVandivier Feb 1, 2021
1033447
refactor: react prop-types lib for Help
KaiVandivier Feb 1, 2021
61167a3
docs: description, args, stories for Help
KaiVandivier Feb 1, 2021
abd50d8
refactor: react prop-types lib for Layer
KaiVandivier Feb 2, 2021
f59f98a
refactor: use fragment to be detected by react-docgen
KaiVandivier Feb 2, 2021
fc35c3f
docs: description, template, and workarounds for Layer
KaiVandivier Feb 2, 2021
5107f00
refactor: react prop-types lib for Legend
KaiVandivier Feb 2, 2021
acbaacd
docs: description, template for Legend
KaiVandivier Feb 2, 2021
31b8eaa
refactor: react prop-types for Logo
KaiVandivier Feb 2, 2021
903fd41
docs: descriptions and args for Logo
KaiVandivier Feb 2, 2021
ef6de5d
refactor: react prop-types lib for MenuItem + annotations
KaiVandivier Feb 2, 2021
6fccee5
docs: description, template, stories, new story for MenuItem
KaiVandivier Feb 2, 2021
b103bf8
refactor: react prop-types lib for MenuDivider
KaiVandivier Feb 2, 2021
2c4f121
docs: description, template, stories for MenuDivider
KaiVandivier Feb 2, 2021
17a0959
refactor: react prop-types lib for MenuSectionHeader
KaiVandivier Feb 2, 2021
286690c
docs: description, template, stories for MenuSectionHeader
KaiVandivier Feb 2, 2021
4f91aee
docs: clarify top-of-list story
KaiVandivier Feb 2, 2021
1286c7a
refactor: react prop-types lib + annotations for Menu
KaiVandivier Feb 2, 2021
185dcd7
docs: description, args for Menu
KaiVandivier Feb 2, 2021
0db7d86
chore: clarify callback comment
KaiVandivier Feb 2, 2021
14e9803
docs: add argTypes for Modal argsTable
KaiVandivier Feb 2, 2021
3d1a89e
Merge branch 'master' into docs/storybook-upgrade
KaiVandivier Feb 2, 2021
cf3ed40
docs: performance, interactive examples, description
KaiVandivier Feb 8, 2021
e7eb39a
docs: fix punctuation
KaiVandivier Feb 8, 2021
6e51dfa
refactor: use react prop-types when possible
KaiVandivier Feb 9, 2021
4ef9005
docs: renovate stories for MultiSelect
KaiVandivier Feb 9, 2021
c7dd370
refactor: react prop-types and prop annotations
KaiVandivier Feb 9, 2021
1652e5e
docs: add some interactivity and description
KaiVandivier Feb 9, 2021
f26c2e8
refactor: react prop-types and annotations
KaiVandivier Feb 9, 2021
e477558
docs: renovate stories for NoticeBox
KaiVandivier Feb 9, 2021
fc5c431
docs: improve popper reference description
KaiVandivier Feb 9, 2021
525a7e5
chore: capitalize PropTypes; add prop annotations
KaiVandivier Feb 9, 2021
4d37838
docs: renovate popover stories
KaiVandivier Feb 9, 2021
7717c4e
chore: upgrade storybook 6.1.14 -> 6.1.17
KaiVandivier Feb 9, 2021
a3a8c41
Merge branch 'master' into docs/storybook-upgrade
KaiVandivier Feb 9, 2021
fcbf2a1
docs: renovate popper stories
KaiVandivier Feb 9, 2021
2b87ff5
refactor: react prop-types lib & prop annotations
KaiVandivier Feb 9, 2021
cb955f7
docs: renovate Radio stories
KaiVandivier Feb 9, 2021
be25493
docs: add to prop annotations
KaiVandivier Feb 9, 2021
b15ba4b
docs: fix primary story
KaiVandivier Feb 9, 2021
c742e57
chore: rename 'a selection' for clarity and consistency
KaiVandivier Feb 9, 2021
ea63051
refactor: react prop-types and prop annotations
KaiVandivier Feb 9, 2021
ffb1073
docs: renovate stories for SingleSelect
KaiVandivier Feb 9, 2021
bc389ec
refactor: react prop-types and prop annotations
KaiVandivier Feb 9, 2021
e7c003a
docs: renovate stories for SplitButton
KaiVandivier Feb 9, 2021
f210986
refactor: react prop-types and prop annotation
KaiVandivier Feb 9, 2021
291c5a9
docs: renovate stories for StackedTable
KaiVandivier Feb 9, 2021
0178efd
chore: add storysource addon
KaiVandivier Feb 9, 2021
b8d22cd
chore(storybook): add console addon
KaiVandivier Feb 10, 2021
65831bc
docs: configure JSX addon
KaiVandivier Feb 10, 2021
5b6f69f
refactor: react prop-types and prop annotations
KaiVandivier Feb 10, 2021
0b1703f
docs: add to prop type annotations
KaiVandivier Feb 10, 2021
6e6d33d
docs: renovate stories for Switch
KaiVandivier Feb 10, 2021
293894e
refactor(tab-bar): react prop-types and prop annotations
KaiVandivier Feb 10, 2021
30ceaa7
docs: clarify prop type annotation
KaiVandivier Feb 10, 2021
08c151c
refactor: react prop-types and prop annotations
KaiVandivier Feb 10, 2021
adab9f5
docs(tab-bar): renovate stories
KaiVandivier Feb 10, 2021
9f77930
refactor: react prop-types and prop annotations
KaiVandivier Feb 10, 2021
96141b2
refactor: react prop-types and prop annotations
KaiVandivier Feb 10, 2021
f1ab194
docs(table): renovate stories
KaiVandivier Feb 10, 2021
2824dcc
refactor: react prop-types and prop annotations
KaiVandivier Feb 10, 2021
b260054
docs(tag): renovate stories
KaiVandivier Feb 10, 2021
306064e
docs: add arg types
KaiVandivier Feb 11, 2021
148755f
docs: remove comment from template
KaiVandivier Feb 11, 2021
9692c3b
docs(textarea): renovate stories
KaiVandivier Feb 11, 2021
e33cc46
refactor: react prop-types and props annotations
KaiVandivier Feb 11, 2021
19df7ff
docs: fix config to enable source code snippets in docs page
KaiVandivier Feb 11, 2021
9b781eb
refactor(tooltip): react prop-types and prop annotations
KaiVandivier Feb 11, 2021
9cfb874
docs(tooltip): renovate stories
KaiVandivier Feb 11, 2021
c52808d
docs(transfer): use default args, add descriptions
KaiVandivier Feb 11, 2021
9ae3018
docs: clarify props
KaiVandivier Feb 11, 2021
695bdaa
refactor: react prop-types and prop annotations
KaiVandivier Feb 11, 2021
9d30283
docs(checkbox-field): renovate stories
KaiVandivier Feb 11, 2021
83103bf
Merge branch 'master' into docs/storybook-upgrade
KaiVandivier Feb 11, 2021
b46ee78
refactor: react prop-types and prop annotations
KaiVandivier Feb 12, 2021
9047668
docs(field-group): renovate stories
KaiVandivier Feb 12, 2021
97364f8
refactor: react prop-types and prop annotations
KaiVandivier Feb 12, 2021
36f7304
docs(file-input-field): renovate stories
KaiVandivier Feb 12, 2021
2374379
refactor: react prop-types and prop annotations
KaiVandivier Feb 12, 2021
513b5a2
docs(file-input-field-with-list): renovate stories
KaiVandivier Feb 12, 2021
9d89af9
docs(file-input-field-with-list): renovate stories
KaiVandivier Feb 12, 2021
16a2c37
docs: remove extra word
KaiVandivier Feb 12, 2021
c8146c1
docs(header-bar): renovate stories
KaiVandivier Feb 12, 2021
dab2eca
refactor: react prop-types
KaiVandivier Feb 12, 2021
05f19f0
chore: fix typo
KaiVandivier Feb 15, 2021
98983c9
refactor(input-field): react prop-types and prop annotations
KaiVandivier Feb 15, 2021
6012d47
docs(input-field): renovate stories
KaiVandivier Feb 15, 2021
b5d5867
refactor(multi-select-field): react prop-types and annotations
KaiVandivier Feb 15, 2021
22db6cd
docs(multi-select-field): renovate stories
KaiVandivier Feb 15, 2021
f0a1f5f
docs: prop annotations
KaiVandivier Feb 15, 2021
49b429e
docs(org-unit-tree): add description and example
KaiVandivier Feb 15, 2021
e65565b
refactor: react prop-types
KaiVandivier Feb 15, 2021
14fcb05
docs(pagination): renovate stories
KaiVandivier Feb 15, 2021
7448d60
refactor(single-select): react prop-types and prop annotations
KaiVandivier Feb 15, 2021
acc2853
docs(single-select-field): renovate stories
KaiVandivier Feb 15, 2021
e167a4a
docs(checkbox-field): uncomment stories
KaiVandivier Feb 15, 2021
773ac20
docs(checkbox-field): add arg types
KaiVandivier Feb 15, 2021
62db87e
refactor(switch-field): react prop-types and prop annotations
KaiVandivier Feb 15, 2021
f8aab6c
docs(switch-field): renovate stories
KaiVandivier Feb 15, 2021
12c4d60
docs(textarea): add some more prop annotations
KaiVandivier Feb 15, 2021
ba4dc90
refactor(textarea-field): react prop-types & prop annotations
KaiVandivier Feb 15, 2021
ef7d7ed
docs(textarea-field): renovate stories
KaiVandivier Feb 15, 2021
fbbbfca
refactor(checkbox-field-ff): react prop-types and annotations
KaiVandivier Feb 16, 2021
f183435
chore: fix 'code' markdown
KaiVandivier Feb 16, 2021
1740cad
docs(checkbox-field-ff): add description
KaiVandivier Feb 16, 2021
4b51f5a
refactor(field-group-ff): react prop-types
KaiVandivier Feb 16, 2021
e1ffe93
docs(field-group-ff): add description
KaiVandivier Feb 16, 2021
23c55ea
refactor: react prop-types
KaiVandivier Feb 16, 2021
e61b3d5
docs(file-input-field-ff): add stories
KaiVandivier Feb 16, 2021
1dfb2db
refactor(input-field-ff): react prop-types
KaiVandivier Feb 16, 2021
777c63c
docs(input-field-ff): add description
KaiVandivier Feb 16, 2021
b30afc5
chore: improve phrasing
KaiVandivier Feb 16, 2021
776392d
refactor(multiselect-field-ff): react prop-types
KaiVandivier Feb 16, 2021
61a502d
docs(multiselect-field-ff): add description
KaiVandivier Feb 16, 2021
a6aeccb
refactor(radio-field-ff): prop-types and annotations
KaiVandivier Feb 16, 2021
67c9619
docs(radio-field-ff): add description
KaiVandivier Feb 16, 2021
4b4102d
refactor(single-select-field-ff): prop-types and annotations
KaiVandivier Feb 16, 2021
b2ae907
docs(single-select-field-ff): add description
KaiVandivier Feb 16, 2021
675b867
docs(multi-select-field-ff): add note about dropdowns
KaiVandivier Feb 16, 2021
55ebf7e
refactor(switch-field-ff): prop-types and annotations
KaiVandivier Feb 16, 2021
b5edf05
docs(switch-field-ff): add descriptions & fix types
KaiVandivier Feb 16, 2021
49eade6
refactor(textarea-field-ff): prop-types and annotations
KaiVandivier Feb 16, 2021
1dd4a55
docs(textarea-field-ff): add description
KaiVandivier Feb 16, 2021
19b68ba
docs: add arg types for final form props
KaiVandivier Feb 16, 2021
3ceba95
docs: mention viewing form values in console
KaiVandivier Feb 16, 2021
b9f5988
docs: replace console.info with .log for 'actions' addon
KaiVandivier Feb 16, 2021
3283e62
docs: disable stories with 'initialFocus' on docs pages
KaiVandivier Feb 16, 2021
d1f878c
docs: remove control from arg type
KaiVandivier Feb 16, 2021
b6232e5
docs: configure 'controls' addon globally
KaiVandivier Feb 16, 2021
b78f057
docs: add docs pages to storybook
KaiVandivier Feb 17, 2021
15424e2
docs(storybook): sort docs pages to top
KaiVandivier Feb 17, 2021
2964ba5
refactor(alert-stack): use fragment for args extraction
KaiVandivier Feb 17, 2021
a13c01e
docs(alert-stack): improve 'note' in description
KaiVandivier Feb 17, 2021
a212f8d
docs(layer): move note
KaiVandivier Feb 17, 2021
87963aa
docs(multi-select): fix comment
KaiVandivier Feb 17, 2021
8a92bb0
refactor: use original default props arrangement
KaiVandivier Feb 17, 2021
5dc502e
docs: handle 'defaultProps' bug better
KaiVandivier Feb 17, 2021
19829c2
docs(storybook): rename storyFn to story
KaiVandivier Feb 17, 2021
e4c51b7
docs: refactor default args to better way
KaiVandivier Feb 18, 2021
4d4c1ed
docs(button): remove unnecessary story description
KaiVandivier Feb 18, 2021
9cafbd3
chore: typo
KaiVandivier Feb 18, 2021
a4da301
chore(storybook): remove unnecessary description
KaiVandivier Feb 18, 2021
bcd200b
docs: add to storybook tips for devs
KaiVandivier Feb 18, 2021
309eb41
chore: fix typo in filename
KaiVandivier Feb 18, 2021
19548f6
docs: refactor to imported markdown
KaiVandivier Feb 18, 2021
51fe3dd
docs: flesh out tips for developers
KaiVandivier Feb 18, 2021
ffb951a
chore: bump storybook
KaiVandivier Feb 18, 2021
176aad6
Merge branch 'master' into docs/storybook-upgrade
KaiVandivier Feb 18, 2021
9cb067a
chore: improve sorting in Docs section
KaiVandivier Feb 19, 2021
7c2d928
chore: add flag for storybook to load static files
KaiVandivier Feb 19, 2021
70a919a
docs: rename to be shorter
KaiVandivier Feb 22, 2021
2061740
docs: reorganize storybook tips to top
KaiVandivier Feb 22, 2021
c663f4c
chore: rename to fix typo
KaiVandivier Feb 22, 2021
0cdabf9
docs: rename section to 'ui docs'
KaiVandivier Feb 22, 2021
5cf16ea
docs: add storybook docs link at top
KaiVandivier Feb 22, 2021
ab33005
docs: rename to 'tips for maintainers'
KaiVandivier Feb 22, 2021
5662b9f
docs: add page to guide readers
KaiVandivier Feb 22, 2021
011a921
docs(tips-for-readers): add tip about subcomponents
KaiVandivier Feb 22, 2021
f91ddcc
docs: add args and source code instructions for maintainers
KaiVandivier Feb 22, 2021
0bf9013
docs: enable theming using CSS escape hatch
KaiVandivier Mar 1, 2021
f36f566
docs: improve theme
KaiVandivier Mar 1, 2021
085927c
docs: rename meta sections and pages
KaiVandivier Mar 1, 2021
e48d765
docs: config docs page to rename 'stories' section 'examples'
KaiVandivier Mar 1, 2021
35bac56
Merge branch 'master' into docs/storybook-upgrade
KaiVandivier Mar 1, 2021
0c1af62
chore: rename storybook css files
KaiVandivier Mar 1, 2021
b240733
chore: upgrade storybook to 6.1.20
KaiVandivier Mar 1, 2021
36b0817
docs: correctly import renamed css files
KaiVandivier Mar 2, 2021
dc2ccf6
docs: use darker teal on 'expandable' prop types
KaiVandivier Mar 3, 2021
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
16 changes: 14 additions & 2 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ module.exports = {
// https://storybook.js.org/docs/react/configure/overview#configure-story-loading
stories: isTesting
? ['../packages/*/src/**/*.stories.e2e.@(js|jsx)']
: ['../packages/*/src/**/*.stories.@(js|jsx)'],
addons: ['@storybook/preset-create-react-app', 'storybook-addon-jsx'],
: [
'../docs/**/*.stories.mdx',
'../packages/*/src/**/*.stories.@(js|jsx)',
],
addons: [
'@storybook/preset-create-react-app',
'@storybook/addon-essentials',
{
name: '@storybook/addon-storysource',
options: { loaderOptions: { injectDecorator: false } },
},
'storybook-addon-jsx',
'@storybook/addon-a11y',
],
}
13 changes: 13 additions & 0 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- these assets are loaded by adding the `-s .storybook/static` flag
to the run script -->
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link
rel="icon"
type="image/png"
href="dhis2-icon-rgb-positive.png"
sizes="192x192"
/>

<!-- Stylesheet to theme storybook UI (stylesheet for docs is linked in preview-head.html) -->
<!-- https://storybook.js.org/docs/react/configure/theming#css-escape-hatches -->
<link rel="stylesheet" href="manager.css" />
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 theme from './theme'

addons.setConfig({
theme: theme
})
3 changes: 3 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- This stylesheet applies to pages in the docs tab -->
<!-- https://storybook.js.org/docs/react/configure/theming#css-escape-hatches -->
<link rel="stylesheet" href="preview.css" />
63 changes: 54 additions & 9 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import '@fontsource/roboto/latin.css'
import React, { Fragment } from 'react'
import { jsxDecorator } from 'storybook-addon-jsx'
import { addDecorator, addParameters } from '@storybook/react'
import '@storybook/addon-console'
import {
Title,
Subtitle,
Description,
Primary,
ArgsTable,
Stories,
PRIMARY_STORY,
} from '@storybook/addon-docs/blocks'
import { CssReset } from '@dhis2/ui-core'

// Enable storybook jsx visualization
Expand Down Expand Up @@ -32,16 +42,51 @@ addDecorator(Component => (
</Fragment>
))

/**
* Sort all our stories alphabetically
*
* See: https://storybook.js.org/docs/configurations/options-parameter/#sorting-stories
*/
addParameters({
options: {
storySort: (a, b) =>
a[1].kind === b[1].kind
? 0
: a[1].id.localeCompare(b[1].id, undefined, { numeric: true }),
storySort: {
// Manually sort top content
order: [
'About This Documentation',
['For readers', 'For maintainers'],
'Using UI',
[
'Getting Started',
'Troubleshooting',
'Advanced Usage',
'Recipes',
],
],
// Then sort the rest alphabetically
method: 'alphabetical',
},
},
docs: {
// Customize docs page layout (in order to rename 'Stories' section)
page: () => (
<>
<Title />
<Subtitle />
<Description />
<Primary />
<ArgsTable story={PRIMARY_STORY} />
<Stories title="Examples" />
</>
),
},
jsx: {
filterProps: val => val !== undefined,
showDefaultProps: false,
functionValue: fn => fn.name,
tabStop: 4,
maxInlineAttributesLineLength: 80,
},
// A11y addon config
a11y: {
// the target DOM element
element: '#root',
// execution mode for the addon
manual: false,
},
controls: { hideNoControlsWarning: true, expanded: true },
})
Binary file added .storybook/static/dhis2-icon-rgb-positive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .storybook/static/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions .storybook/static/manager.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Styles to customize storybook manager UI (search, sidebar, etc) go here */

.sidebar-subheading {
color: #4a5768 !important;
}
9 changes: 9 additions & 0 deletions .storybook/static/preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Styles for storybook docs or anything else in the 'preview' frame go here */

.sbdocs.sbdocs-a:hover {
text-decoration: underline;
}

.sbdocs-expandable {
color: #004D40 !important; /* teal800 */
}
91 changes: 91 additions & 0 deletions .storybook/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { create } from '@storybook/theming/create'
import { colors } from '@dhis2/ui-constants'

/**
* See here for an example of these values:
* https://github.com/storybookjs/storybook/blob/master/lib/theming/src/themes/light.ts
*/
export default create({
/** Main theme ('light' or 'dark') */
base: 'light',

/**
* Color palette
*/
/** Not sure where this is applied */
// colorPrimary: '#FF4785', // Storybook coral

/**
* '4-square' icon in sidebar, sidebar highlight color, link color,
* toolbar icon color (when hovered), focused input highlight
*/
colorSecondary: colors.teal600,

/**
* UI
*/
/** Background of side bar & rest of page: */
appBg: colors.grey050,

/** Background of preview & docs ('app') frame: */
// appContentBg: 'white',

/** Color for 'glowing' placeholders for loading stories AND lines in app frame: */
// appBorderColor: 'red',

/** Border radius of app frame */
// appBorderRadius: 4,

/**
* Typography ---
*/
/** Affects text in sidebar */
// fontBase: '"Georgia", serif',
// fontCode: 'monospace',

/**
* Text colors
*/
/** Color for text in sidebar and addons */
// textColor: 'blue',

/** Not sure where this applies */
// textInverseColor: 'green', // 'rgba(255,255,255,0.9)',

/** Text in search bar */
// textMutedColor: 'purple',

/**
* Toolbar default and active colors ---
*/
/** Color of text & icons in toolbars (addons and top bar) when unselected */
// barTextColor: 'purple',

/** Text color and underline of selected tab in toolbars (e.g. Canvas, Controls) */
barSelectedColor: colors.teal600,

/** Background color of toolbars (addons and top bar) */
// barBg: 'yellow',

/**
* Form colors
*/
/** Mostly self-explanatory */
// inputBg: "red",

/** Border while not focused - when focused, uses 'colorSecondary' */
// inputBorder: 'purple',

// inputTextColor: 'green',
// inputBorderRadius: 0,

/**
* Brand
*/
brandTitle: 'DHIS2 UI',
// TODO: Better place to send this?
brandUrl: 'https://www.dhis2.org',
// TODO: Serve this statically?
brandImage:
'https://raw.githubusercontent.com/dhis2/dhis2-identity/master/web/Logo/Default/dhis2-logo-rgb-positive.svg',
})
6 changes: 6 additions & 0 deletions docs/advanced-usage.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Meta, Description } from '@storybook/addon-docs/blocks'
import AdvancedUsage from './advanced-usage.md'

<Meta title="Using UI/Advanced Usage" />

<Description>{AdvancedUsage}</Description>
6 changes: 6 additions & 0 deletions docs/getting-started.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Meta, Description } from '@storybook/addon-docs/blocks'
import GettingStarted from './getting-started.md'

<Meta title="Using UI/Getting Started" />

<Description>{GettingStarted}</Description>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Meta, Description } from '@storybook/addon-docs/blocks'
import markdown from './transfer-infinite-loading-all-options-selected.md'

<Meta title="Using UI/Recipes/Transfer: Infinite Loading, All Options Selected" />

<Description>{markdown}</Description>
Loading