diff --git a/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.stories.ts b/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.stories.ts index 4c28eaa7408..d7aa4a8bf71 100644 --- a/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.stories.ts +++ b/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.stories.ts @@ -2,6 +2,8 @@ import type { StoryFn } from '@storybook/vue3-vite'; import { action } from 'storybook/actions'; import N8nActionBox from './ActionBox.vue'; +import N8nLink from '../N8nLink'; +import N8nText from '../N8nText'; export default { title: 'Atoms/ActionBox', @@ -23,7 +25,7 @@ const methods = { onClick: action('click'), }; -const Template: StoryFn = (args, { argTypes }) => ({ +const DefaultTemplate: StoryFn = (args, { argTypes }) => ({ setup: () => ({ args }), props: Object.keys(argTypes), components: { @@ -33,11 +35,49 @@ const Template: StoryFn = (args, { argTypes }) => ({ methods, }); -export const ActionBox = Template.bind({}); +export const ActionBox = DefaultTemplate.bind({}); ActionBox.args = { - emoji: '😿', + icon: { type: 'emoji', value: '😿' }, heading: 'Headline you need to know', description: 'Long description that you should know something is the way it is because of how it is. ', buttonText: 'Do something', }; + +export const ActionBoxWithIcon = DefaultTemplate.bind({}); +ActionBoxWithIcon.args = { + icon: { type: 'icon', value: 'tree-pine' }, + heading: 'Create your first workflow', + description: 'Get started by creating a new workflow to automate your tasks.', + buttonText: 'Create Workflow', +}; + +const WithAdditionalContentTemplate: StoryFn = (args, { argTypes }) => ({ + setup: () => ({ args }), + props: Object.keys(argTypes), + components: { + N8nActionBox, + N8nText, + N8nLink, + }, + template: ` + + + + `, + methods, +}); + +export const ActionBoxWithAdditionalContent = WithAdditionalContentTemplate.bind({}); +ActionBoxWithAdditionalContent.args = { + icon: { type: 'emoji', value: '🚀' }, + heading: 'Launch your project', + description: + 'Get started with your project by clicking the button below. Additional content is included.', + buttonText: 'Get Started', +}; diff --git a/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.test.ts b/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.test.ts index 9557f679218..f075659904f 100644 --- a/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.test.ts +++ b/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.test.ts @@ -3,10 +3,10 @@ import { render } from '@testing-library/vue'; import N8NActionBox from './ActionBox.vue'; describe('N8NActionBox', () => { - it('should render correctly', () => { + it('should render correctly with emoji', () => { const wrapper = render(N8NActionBox, { props: { - emoji: '😿', + icon: { type: 'emoji', value: '😿' }, heading: 'Headline you need to know', description: 'Long description that you should know something is the way it is because of how it is. ', @@ -19,4 +19,20 @@ describe('N8NActionBox', () => { }); expect(wrapper.html()).toMatchSnapshot(); }); + + it('should render correctly with icon', () => { + const wrapper = render(N8NActionBox, { + props: { + icon: { type: 'icon', value: 'plus' }, + heading: 'Add something new', + description: 'Click the button to add a new item.', + buttonText: 'Add Item', + buttonType: 'primary', + }, + global: { + stubs: ['N8nHeading', 'N8nText', 'N8nButton', 'N8nCallout', 'N8nIcon'], + }, + }); + expect(wrapper.html()).toMatchSnapshot(); + }); }); diff --git a/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.vue b/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.vue index 6f41a9e9560..d0ab6fe7c50 100644 --- a/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.vue +++ b/packages/frontend/@n8n/design-system/src/components/N8nActionBox/ActionBox.vue @@ -3,12 +3,14 @@ import type { ButtonType } from '../../types/button'; import N8nButton from '../N8nButton'; import N8nCallout, { type CalloutTheme } from '../N8nCallout'; import N8nHeading from '../N8nHeading'; +import N8nIcon from '../N8nIcon'; import { type IconName } from '../N8nIcon/icons'; +import type { IconOrEmoji } from '../N8nIconPicker/types'; import N8nText from '../N8nText'; import N8nTooltip from '../N8nTooltip/Tooltip.vue'; interface ActionBoxProps { - emoji?: string; + icon?: IconOrEmoji; heading?: string; buttonText?: string; buttonType?: ButtonType; @@ -29,8 +31,15 @@ withDefaults(defineProps(), {