Files
n8n-enterprise-unlocked/packages/design-system/src/components/N8nNotice/Notice.stories.ts
Iván Ovejero d9b98fc8be refactor: Lint for no unneeded backticks (#5057) (no-changelog)
*  Create rule `no-unneeded-backticks`

* 👕 Enable rule

*  Run rule on `cli`

*  Run rule on `core`

*  Run rule on `workflow`

*  Rule rule on `design-system`

*  Run rule on `node-dev`

*  Run rule on `editor-ui`

*  Run rule on `nodes-base`
2022-12-29 12:20:43 +01:00

74 lines
1.8 KiB
TypeScript

import N8nNotice from './Notice.vue';
import type { StoryFn } from '@storybook/vue';
export default {
title: 'Atoms/Notice',
component: N8nNotice,
argTypes: {
theme: {
control: 'select',
options: ['success', 'warning', 'danger', 'info'],
},
},
};
const SlotTemplate: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nNotice,
},
template:
'<n8n-notice v-bind="$props">This is a notice! Thread carefully from this point forward.</n8n-notice>',
});
const PropTemplate: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nNotice,
},
template: '<n8n-notice v-bind="$props"/>',
});
export const Warning = SlotTemplate.bind({});
Warning.args = {
theme: 'warning',
};
export const Danger = SlotTemplate.bind({});
Danger.args = {
theme: 'danger',
};
export const Success = SlotTemplate.bind({});
Success.args = {
theme: 'success',
};
export const Info = SlotTemplate.bind({});
Info.args = {
theme: 'info',
};
export const Sanitized = PropTemplate.bind({});
Sanitized.args = {
theme: 'warning',
content:
'<script>alert(1)</script> This content contains a script tag and is <strong>sanitized</strong>.',
};
export const Truncated = PropTemplate.bind({});
Truncated.args = {
theme: 'warning',
truncate: true,
content:
'This content is long and will be truncated at 150 characters. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
};
export const HtmlEdgeCase = PropTemplate.bind({});
HtmlEdgeCase.args = {
theme: 'warning',
truncate: true,
content:
'This content is long and will be truncated at 150 characters. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod <a href="">read the documentation</a> ut labore et dolore magna aliqua.',
};