From f0fe1de5a7c41f452ad987e1bd96389f124e9932 Mon Sep 17 00:00:00 2001 From: David Nixon Date: Mon, 11 Dec 2023 16:23:13 -0500 Subject: [PATCH] fix: add html option for inline notification --- .../CvInlineNotification.stories.js | 59 ++++++++++++++++++- .../CvNotification/CvInlineNotification.vue | 16 ++++- .../CvInlineNotificationTemplate.mdx | 16 +++++ 3 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 src/components/CvNotification/CvInlineNotificationTemplate.mdx diff --git a/src/components/CvNotification/CvInlineNotification.stories.js b/src/components/CvNotification/CvInlineNotification.stories.js index 404bea889..dca85bef7 100644 --- a/src/components/CvNotification/CvInlineNotification.stories.js +++ b/src/components/CvNotification/CvInlineNotification.stories.js @@ -1,7 +1,8 @@ import { action } from '@storybook/addon-actions'; -import { sbCompPrefix } from '../../global/storybook-utils'; +import { sbCompPrefix, storySourceCode } from '../../global/storybook-utils'; import { CvInlineNotification, CvNotificationConsts } from '.'; +import DocumentationTemplate from './CvInlineNotificationTemplate.mdx'; export default { title: `${sbCompPrefix}/CvInlineNotification`, @@ -59,6 +60,11 @@ export default { control: { type: 'boolean' }, }, }, + parameters: { + docs: { + page: DocumentationTemplate, + }, + }, }; const template = ``; @@ -79,6 +85,10 @@ const Template = args => { export const Info = Template.bind({}); Info.args = { kind: CvNotificationConsts.notificationKinds[0], + primary: true, +}; +Info.parameters = { + docs: { source: { code: storySourceCode(template, Info.args) } }, }; export const InfoSquare = Template.bind({}); @@ -86,24 +96,71 @@ InfoSquare.storyName = 'Info square'; InfoSquare.args = { kind: CvNotificationConsts.notificationKinds[1], }; +InfoSquare.parameters = { + docs: { source: { code: storySourceCode(template, InfoSquare.args) } }, +}; export const Success = Template.bind({}); Success.args = { kind: CvNotificationConsts.notificationKinds[2], }; +Success.parameters = { + docs: { source: { code: storySourceCode(template, Success.args) } }, +}; export const Warning = Template.bind({}); Warning.args = { kind: CvNotificationConsts.notificationKinds[3], }; +Warning.parameters = { + docs: { source: { code: storySourceCode(template, Warning.args) } }, +}; export const WarningAlt = Template.bind({}); WarningAlt.storyName = 'Warning (alt)'; WarningAlt.args = { kind: CvNotificationConsts.notificationKinds[4], }; +WarningAlt.parameters = { + docs: { source: { code: storySourceCode(template, WarningAlt.args) } }, +}; export const Error = Template.bind({}); Error.args = { kind: CvNotificationConsts.notificationKinds[5], }; +Error.parameters = { + docs: { source: { code: storySourceCode(template, Error.args) } }, +}; + +const templateSlots = ` + + + + `; +const SlotTemplate = args => { + return { + components: { CvInlineNotification }, + template: templateSlots, + setup() { + return { + onAction: action('action'), + onClose: action('close'), + args, + }; + }, + }; +}; +export const Slots = SlotTemplate.bind({}); +Slots.args = { + kind: CvNotificationConsts.notificationKinds[0], + actionLabel: '', + hideCloseButton: true, +}; +Slots.parameters = { + docs: { source: { code: storySourceCode(templateSlots, Slots.args) } }, +}; diff --git a/src/components/CvNotification/CvInlineNotification.vue b/src/components/CvNotification/CvInlineNotification.vue index 2c7184c6e..7c2945911 100644 --- a/src/components/CvNotification/CvInlineNotification.vue +++ b/src/components/CvNotification/CvInlineNotification.vue @@ -15,10 +15,14 @@ />

- {{ title }} + + {{ title }} +

- {{ subTitle }} + + {{ subTitle }} +
@@ -35,6 +39,7 @@ {{ actionLabel }}