mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 06:23:00 +08:00
Add note
This commit is contained in:
parent
71732da261
commit
53ccc0139d
@ -12,25 +12,45 @@ storiesOf('Custom|Module Context', module)
|
||||
imports: [ChipsModule],
|
||||
})
|
||||
)
|
||||
.add('Component with self and child component declared in its feature module', () => {
|
||||
const props: { [K in keyof ChipsGroupComponent]?: any } = {
|
||||
chips: object('Chips', [
|
||||
{
|
||||
id: 1,
|
||||
text: 'Chip 1',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: 'Chip 2',
|
||||
},
|
||||
]),
|
||||
};
|
||||
return {
|
||||
component: ChipsGroupComponent,
|
||||
requiresComponentDeclaration: false,
|
||||
props,
|
||||
};
|
||||
})
|
||||
.add(
|
||||
'Component with self and child component declared in its feature module',
|
||||
() => {
|
||||
const props: { [K in keyof ChipsGroupComponent]?: any } = {
|
||||
chips: object('Chips', [
|
||||
{
|
||||
id: 1,
|
||||
text: 'Chip 1',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: 'Chip 2',
|
||||
},
|
||||
]),
|
||||
};
|
||||
return {
|
||||
component: ChipsGroupComponent,
|
||||
requiresComponentDeclaration: false,
|
||||
props,
|
||||
};
|
||||
},
|
||||
{
|
||||
notes: `
|
||||
Typically, when developing features in Angular, it is advantageous to use "feature modules"
|
||||
which provide a "context" for declared components including required imports, declarations,
|
||||
and providers.
|
||||
|
||||
To simulate this context in Storybook, we may want to use the component delcared in this
|
||||
context, rather than having to recreate this context using just to get the component to
|
||||
perform its basic functionality.
|
||||
|
||||
However, as the default behavior of Storkybook for Angular is to delcare specified components
|
||||
in a dynamic module, which prevents us from using the version of the component declared in our
|
||||
feature module (with its appropriate context).
|
||||
|
||||
To prevent this dynamic declaration, set the "requiresComponentDeclaration" flag to false.
|
||||
`,
|
||||
}
|
||||
)
|
||||
.add('Child component', () => {
|
||||
const props: { [K in keyof ChipComponent]?: any } = {
|
||||
displayText: text('displayText', 'My Chip'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user