-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(storybook): upgrade in stories
- Loading branch information
Showing
14 changed files
with
331 additions
and
306 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
51 changes: 28 additions & 23 deletions
51
...ggestion-list/components/suggestions-list-item/suggestions-list-item.component.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 |
---|---|---|
@@ -1,49 +1,54 @@ | ||
import { moduleMetadata, Story } from '@storybook/angular'; | ||
import { moduleMetadata, StoryObj, Meta } from '@storybook/angular'; | ||
|
||
import { CommonModule } from '@angular/common'; | ||
|
||
import { SuggestionsListItemComponent } from './suggestions-list-item.component'; | ||
|
||
export default { | ||
type Args = SuggestionsListItemComponent & { item: Record<string, string> }; | ||
|
||
const meta: Meta<Args> = { | ||
title: 'Library/Block Editor/Components/Suggestions List Item', | ||
decorators: [ | ||
moduleMetadata({ | ||
declarations: [SuggestionsListItemComponent], | ||
imports: [CommonModule] | ||
}) | ||
], | ||
component: SuggestionsListItemComponent | ||
component: SuggestionsListItemComponent, | ||
render: (args) => ({ | ||
props: args, | ||
template: ` | ||
<dot-suggestions-list-item [item]='item' /> | ||
` | ||
}) | ||
}; | ||
export default meta; | ||
|
||
export const Icon: Story<SuggestionsListItemComponent> = (args) => ({ | ||
props: { | ||
...args, | ||
item: iconItem | ||
}, | ||
template: ` | ||
<dot-suggestions-list-item [item]='item'></dot-suggestions-list-item> | ||
` | ||
}); | ||
|
||
export const Image: Story<SuggestionsListItemComponent> = (args) => ({ | ||
props: { | ||
...args, | ||
item: imageItem | ||
}, | ||
template: ` | ||
<dot-suggestions-list-item [item]='item'></dot-suggestions-list-item> | ||
` | ||
}); | ||
type Story = StoryObj<Args>; | ||
|
||
// Test Data | ||
const iconItem: Record<string, string> = { | ||
title: 'An Icon', | ||
type: 'icon', | ||
icon: '+' | ||
}; | ||
|
||
export const Icon: Story = { | ||
args: { | ||
item: iconItem | ||
}, | ||
}; | ||
|
||
const imageItem: Record<string, string> = { | ||
title: 'Landscape', | ||
type: 'image', | ||
url: 'https://images.unsplash.com/photo-1508162942367-e4dd4cd67513?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1100&q=80' | ||
}; | ||
|
||
export const Image: Story = { | ||
args: { | ||
item: imageItem | ||
}, | ||
}; | ||
|
||
|
||
|
30 changes: 17 additions & 13 deletions
30
...ock-editor/src/lib/shared/components/suggestion-list/suggestion-list.component.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 |
---|---|---|
@@ -1,28 +1,32 @@ | ||
import { moduleMetadata, Story } from '@storybook/angular'; | ||
import { moduleMetadata, StoryObj, Meta } from '@storybook/angular'; | ||
|
||
import { CommonModule } from '@angular/common'; | ||
|
||
import { SuggestionsListItemComponent } from './components/suggestions-list-item/suggestions-list-item.component'; | ||
import { SuggestionListComponent } from './suggestion-list.component'; | ||
|
||
export default { | ||
const meta: Meta = { | ||
title: 'Library/Block Editor/Components/Suggestion List', | ||
decorators: [ | ||
moduleMetadata({ | ||
declarations: [SuggestionListComponent, SuggestionsListItemComponent], | ||
imports: [CommonModule] | ||
}) | ||
], | ||
component: SuggestionListComponent | ||
component: SuggestionListComponent, | ||
render: (args) => ({ | ||
props: args, | ||
template: ` | ||
<dot-suggestion-list> | ||
<dot-suggestions-list-item>Option 1</dot-suggestions-list-item> | ||
<dot-suggestions-list-item>Option 2</dot-suggestions-list-item> | ||
<dot-suggestions-list-item>Option 3</dot-suggestions-list-item> | ||
</dot-suggestion-list> | ||
` | ||
}) | ||
}; | ||
export default meta; | ||
|
||
export const ManyItems: Story<SuggestionListComponent> = (args) => ({ | ||
props: args, | ||
template: ` | ||
<dot-suggestion-list> | ||
<dot-suggestions-list-item>Option 1</dot-suggestions-list-item> | ||
<dot-suggestions-list-item>Option 2</dot-suggestions-list-item> | ||
<dot-suggestions-list-item>Option 3</dot-suggestions-list-item> | ||
</dot-suggestion-list> | ||
` | ||
}); | ||
type Story = StoryObj; | ||
|
||
export const ManyItems: Story = {}; |
Oops, something went wrong.