Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storybook): more changes for controls
- Loading branch information
katerina
committed
Jun 22, 2021
1 parent
4c2d4fe
commit 9446ba1
Showing
11 changed files
with
48 additions
and
27 deletions.
There are no files selected for viewing
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
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
29 changes: 18 additions & 11 deletions
29
...ges/angular/src/generators/component-story/files/__componentFileName__.stories.ts__tmpl__
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 |
---|---|---|
@@ -1,16 +1,23 @@ | ||
<% if(props.length > 0) { %>import { text, number, boolean } from '@storybook/addon-knobs';<% } %> | ||
import { moduleMetadata, Story, Meta } from '@storybook/angular'; | ||
import { <%=componentName%> } from './<%=componentFileName%>'; | ||
|
||
export default { | ||
title: '<%=componentName%>', | ||
component: <%=componentName%> | ||
} | ||
component: <%=componentName%>, | ||
decorators: [ | ||
moduleMetadata({ | ||
imports: [], | ||
}) | ||
], | ||
} as Meta; | ||
|
||
export const primary = () => ({ | ||
moduleMetadata: { | ||
imports: [] | ||
}, | ||
props: {<% for (let prop of props) { %> | ||
<%=prop.name%>: <%=prop.type%>('<%=prop.name%>', <%-prop.defaultValue%>),<% } %> | ||
} | ||
}) | ||
const Template: Story<<%=componentName%>> = (args: <%=componentName%>) => ({ | ||
component: <%=componentName%>, | ||
props: args, | ||
}); | ||
|
||
|
||
export const primary = Template.bind({}); | ||
primary.args = {<% for (let prop of props) { %> | ||
<%= prop.name %>: <%- prop.defaultValue %>,<% } %> | ||
} |
2 changes: 1 addition & 1 deletion
2
...onent-story/lib/get-knob-default-value.ts → ...nt-story/lib/get-control-default-value.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
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
6 changes: 3 additions & 3 deletions
6
...ages/react/src/generators/component-story/files/__componentFileName__.stories.__fileExt__
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
4 changes: 0 additions & 4 deletions
4
packages/storybook/src/generators/configuration/project-files/.storybook/preview.js__tmpl__
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 |
---|---|---|
@@ -1,4 +0,0 @@ | ||
import { addDecorator } from '<%= uiFramework %>'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
|
||
addDecorator(withKnobs); | ||
2 changes: 1 addition & 1 deletion
2
packages/storybook/src/generators/configuration/root-files/.storybook/main.js
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
stories: [], | ||
addons: ['@storybook/addon-knobs/register'], | ||
addons: ['@storybook/addon-controls'], | ||
}; |
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
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
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