From d3129e2ad5cf6dc0707165fa7f4361552e72e5f7 Mon Sep 17 00:00:00 2001 From: Marcin Krueger Date: Wed, 17 Aug 2022 15:29:42 +0200 Subject: [PATCH] [AAE-10202] Storybook EmptyContent component (#7745) * [AAE-10202] Storybook add EmptyContent component stories * [AAE-10202] Storybook add documentation table for stories * [AAE-10202] Storybook change stories title path * [AAE-10202] Storybook add type for template args * Trigger travis * [AAE-10202] Storybook fix error with updated version --- .../empty-content.component.stories.ts | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 lib/core/templates/empty-content/empty-content.component.stories.ts diff --git a/lib/core/templates/empty-content/empty-content.component.stories.ts b/lib/core/templates/empty-content/empty-content.component.stories.ts new file mode 100644 index 00000000000..7ff4693b57d --- /dev/null +++ b/lib/core/templates/empty-content/empty-content.component.stories.ts @@ -0,0 +1,117 @@ +/*! + * @license + * Copyright 2022 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Meta, moduleMetadata, Story } from '@storybook/angular'; +import { EmptyContentComponent } from './empty-content.component'; +import { CoreStoryModule } from '../../testing/core.story.module'; +import { TemplateModule } from '../template.module'; + +export default { + component: EmptyContentComponent, + title: 'Core/Template/Empty Content', + decorators: [ + moduleMetadata({ + imports: [CoreStoryModule, TemplateModule] + }) + ], + argTypes: { + icon: { + description: 'Angular Material icon', + table: { + category: 'Component Inputs', + type: { + summary: 'string' + }, + defaultValue: { + summary: 'cake' + } + } + }, + title: { + table: { + category: 'Component Inputs', + type: { + summary: 'string' + }, + defaultValue: { + summary: '' + } + } + }, + subtitle: { + table: { + category: 'Component Inputs', + type: { + summary: 'string' + }, + defaultValue: { + summary: '' + } + } + }, + lines: { + name: 'lines', + description: 'Content Projection Text', + control: {type: 'object'}, + defaultValue: [ + 'Items you removed are moved to the Trash', + 'Empty Trash to permanently delete items' + ], + table: { + category: 'Strories Controls', + type: { + summary: 'array' + } + } + } + } +} as Meta; + +const template: Story = ( + args: EmptyContentComponent +) => ({ + props: args +}); + +export const defaultStory = template.bind({}); +defaultStory.argTypes = { + lines: { + control: { disable: true } + } +}; +defaultStory.args = { + icon: 'star_rate', + title: 'No favourite files or folders', + subtitle: 'Favourite items that you want to easily find later' +}; +defaultStory.storyName = 'Default'; + +export const multipleLines: Story = ( + args: EmptyContentComponent & { lines: string[] } +) => ({ + props: { + ...args + }, + template: ` + +

+ {{ line }} +

+
` +});