-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19162 from storybookjs/shilman/generic-docspage-s…
…tories Addon-docs: Generic stories for DocsPage
- Loading branch information
Showing
18 changed files
with
148 additions
and
357 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
code/addons/docs/template/stories/docspage/basic.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import globalThis from 'global'; | ||
|
||
export default { | ||
component: globalThis.Components.Button, | ||
args: { children: 'Click Me!' }, | ||
parameters: { chromatic: { disable: true } }, | ||
}; | ||
|
||
export const Basic = { | ||
args: { children: 'Basic' }, | ||
}; | ||
|
||
export const Disabled = { | ||
args: { children: 'Disabled in DocsPage' }, | ||
parameters: { docs: { disable: true } }, | ||
}; | ||
|
||
export const Another = { | ||
args: { children: 'Another' }, | ||
}; |
30 changes: 30 additions & 0 deletions
30
code/addons/docs/template/stories/docspage/description.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import globalThis from 'global'; | ||
|
||
export default { | ||
component: globalThis.Components.Button, | ||
// FIXME: remove array subcomponents in 7.0? | ||
subcomponents: { | ||
Pre: globalThis.Components.Pre, | ||
}, | ||
args: { children: 'Click Me!' }, | ||
parameters: { | ||
docs: { | ||
description: { | ||
component: '**Component** description', | ||
}, | ||
}, | ||
chromatic: { disable: true }, | ||
}, | ||
}; | ||
|
||
export const Basic = {}; | ||
|
||
export const CustomDescription = { | ||
parameters: { | ||
docs: { | ||
description: { | ||
story: '**Story** description', | ||
}, | ||
}, | ||
}, | ||
}; |
17 changes: 17 additions & 0 deletions
17
code/addons/docs/template/stories/docspage/extract-description.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import globalThis from 'global'; | ||
|
||
export default { | ||
component: globalThis.Components.Button, | ||
args: { children: 'Click Me!' }, | ||
parameters: { | ||
docs: { | ||
// FIXME: this is typically provided by the renderer preset to extract | ||
// the description automatically based on docgen info. including here | ||
// for documentation purposes only. | ||
extractComponentDescription: () => 'component description', | ||
}, | ||
chromatic: { disable: true }, | ||
}, | ||
}; | ||
|
||
export const Basic = {}; |
12 changes: 12 additions & 0 deletions
12
code/addons/docs/template/stories/docspage/overflow.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import globalThis from 'global'; | ||
|
||
export default { | ||
component: globalThis.Components.Pre, | ||
args: { | ||
text: 'Demonstrates overflow', | ||
style: { width: 2000, height: 500, background: 'hotpink' }, | ||
}, | ||
parameters: { chromatic: { disable: true } }, | ||
}; | ||
|
||
export const Basic = {}; |
25 changes: 25 additions & 0 deletions
25
code/addons/docs/template/stories/docspage/override.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import globalThis from 'global'; | ||
|
||
// FIXME: do this using basic React functions for multi-framework | ||
// once sandbox linking is working | ||
// | ||
// import { createElement } from 'react'; | ||
// import { Title, Primary } from '@storybook/addon-docs'; | ||
// | ||
// const Override = () => | ||
// createElement('div', { style: { border: '10px solid green', padding: '100px' } }, [ | ||
// createElement(Title), | ||
// createElement(Primary), | ||
// ]); | ||
const Override = () => 'overridden'; | ||
|
||
export default { | ||
component: globalThis.Components.Button, | ||
args: { children: 'Click Me!' }, | ||
parameters: { | ||
chromatic: { disable: true }, | ||
docs: { page: Override }, | ||
}, | ||
}; | ||
|
||
export const Basic = {}; |
43 changes: 43 additions & 0 deletions
43
code/addons/docs/template/stories/docspage/source.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import globalThis from 'global'; | ||
|
||
export default { | ||
component: globalThis.Components.Button, | ||
args: { children: 'Click Me!' }, | ||
parameters: { chromatic: { disable: true } }, | ||
}; | ||
|
||
export const Auto = {}; | ||
|
||
export const Disabled = { | ||
parameters: { | ||
docs: { | ||
source: { code: null }, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Code = { | ||
parameters: { | ||
docs: { | ||
source: { type: 'code' }, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Custom = { | ||
parameters: { | ||
docs: { | ||
source: { code: 'custom source' }, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Transform = { | ||
parameters: { | ||
docs: { | ||
transformSource(src: string) { | ||
return `// We transformed this!\nconst example = (\n${src}\n);`; | ||
}, | ||
}, | ||
}, | ||
}; |
144 changes: 0 additions & 144 deletions
144
code/examples/official-storybook/stories/addon-docs/addon-docs-blocks.stories.js
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
code/examples/official-storybook/stories/addon-docs/addon-docs.stories.js
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
code/examples/official-storybook/stories/addon-docs/array-subcomponents.stories.js
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
code/examples/official-storybook/stories/addon-docs/dynamic-title.stories.js
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
code/examples/official-storybook/stories/addon-docs/memo.stories.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.