diff --git a/docs/package.json b/docs/package.json index 678b12b3..d051c37e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -57,6 +57,8 @@ "prettier": "^3.2", "remark-gfm": "^4.0", "rimraf": "^5.0", + "sass": "^1.76", + "sass-loader": "^14.2", "storybook": "^8.0", "storybook-dark-mode": "^4.0", "typescript": "^5.4", diff --git a/docs/src/components/alert/fb-alert.mdx b/docs/src/components/alert/fb-alert.mdx index 11402655..06d64c16 100644 --- a/docs/src/components/alert/fb-alert.mdx +++ b/docs/src/components/alert/fb-alert.mdx @@ -1,5 +1,5 @@ -import { Canvas, Meta, Controls } from '@storybook/blocks'; -import * as AlertStories from './fb-alert.stories'; +import { Canvas, Meta, Controls } from "@storybook/blocks"; +import * as AlertStories from "./fb-alert.stories"; @@ -15,10 +15,7 @@ Displays important alert messages. ## Basic Usage - + ## Theme @@ -26,10 +23,7 @@ Alert provide two different themes, `light` and `dark`. Set `effect` to change theme, default is `light`. - + ## Customizable Close Button @@ -39,10 +33,7 @@ Alert allows you to configure if it's closable. The close button text and closin can be closed or not. It accepts `boolean`, and the default is `false`. You can set `close-text` property to replace the default cross symbol as the close button. Be careful that `close-text` must be a string. `close` event fires when the component is closed. - + ## With Icon @@ -50,19 +41,13 @@ Displaying an icon improves readability. Setting the `show-icon` property displays an icon that corresponds with the current Alert type. - + ## Centered Text Use the `center` property to center the text. - + ## With Description @@ -71,19 +56,13 @@ Description includes a message with more detailed information. Besides the required `title` slot, you can add a `description` slot to help you describe the alert with more details. Description can only store text string, and it will word wrap automatically. - + ## With Icon and Description At last, this is an example with both icon and description. - + --- diff --git a/docs/src/components/alert/fb-alert.stories.scss b/docs/src/components/alert/fb-alert.stories.scss index e8ac3bbc..c7d1091a 100644 --- a/docs/src/components/alert/fb-alert.stories.scss +++ b/docs/src/components/alert/fb-alert.stories.scss @@ -1,11 +1,11 @@ .fb-alert-story-block { - max-width: 600px; + max-width: 600px; - .fb-alert-story-block__item { - margin-bottom: 20px; - } + .fb-alert-story-block__item { + margin-bottom: 20px; + } - .fb-alert-story-block__item:last-child { - margin-bottom: 0; - } + .fb-alert-story-block__item:last-child { + margin-bottom: 0; + } } diff --git a/docs/src/components/alert/fb-alert.stories.ts b/docs/src/components/alert/fb-alert.stories.ts index 0a7b4330..9d7dda25 100644 --- a/docs/src/components/alert/fb-alert.stories.ts +++ b/docs/src/components/alert/fb-alert.stories.ts @@ -1,118 +1,118 @@ -import { Meta, StoryObj } from '@storybook/vue3'; -import { action } from '@storybook/addon-actions'; -import { fn } from '@storybook/test'; -import { FbAlert } from '@fastybird/web-ui-components'; -import { VariantTypes, EffectTypes } from '@fastybird/web-ui-constants'; +import { Meta, StoryObj } from "@storybook/vue3"; +import { action } from "@storybook/addon-actions"; +import { fn } from "@storybook/test"; +import { FbAlert } from "@fastybird/web-ui-components"; +import { VariantTypes, EffectTypes } from "@fastybird/web-ui-constants"; -import './fb-alert.stories.scss'; +import "./fb-alert.stories.scss"; const meta: Meta = { - component: FbAlert, - title: 'Components/Feedback/Alert', - argTypes: { - title: { - type: { name: 'string', required: false }, - control: { type: 'text' }, - description: 'content of the alert title', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '-' }, - }, - }, - description: { - type: { name: 'string', required: false }, - control: { type: 'text' }, - description: 'content of the alert description', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '-' }, - }, - }, - icon: { - type: { name: 'string', required: false }, - control: { type: 'text' }, - description: 'slot for inserting custom icon. this slot will override default component icon', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '-' }, - }, - }, - default: { - type: { name: 'string', required: false }, - control: { type: 'text' }, - description: 'slot for inserting custom content. This slot will override `title` and `description` slots', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '-' }, - }, - }, - variant: { - type: { name: 'string', required: false }, - control: { type: 'select' }, - options: [VariantTypes.DEFAULT, VariantTypes.PRIMARY, VariantTypes.INFO, VariantTypes.SUCCESS, VariantTypes.WARNING, VariantTypes.ERROR], - description: 'alert variant', - table: { - type: { summary: 'string' }, - defaultValue: { summary: VariantTypes.DEFAULT }, - }, - }, - effect: { - type: { name: 'string', required: false }, - control: { type: 'select' }, - options: [EffectTypes.LIGHT, EffectTypes.DARK], - description: 'alert theme style', - table: { - type: { summary: 'string' }, - defaultValue: { summary: EffectTypes.LIGHT }, - }, - }, - center: { - type: { name: 'boolean', required: false }, - control: { type: 'boolean' }, - description: 'whether content is placed in the center', - table: { - type: { summary: 'boolean' }, - defaultValue: { summary: false }, - }, - }, - closable: { - type: { name: 'boolean', required: false }, - control: { type: 'boolean' }, - description: 'whether alert can be dismissed', - table: { - type: { summary: 'boolean' }, - defaultValue: { summary: false }, - }, - }, - closeText: { - type: { name: 'string', required: false }, - control: { type: 'text' }, - description: 'customized close button text', - table: { - type: { summary: 'string' }, - defaultValue: { summary: undefined }, - }, - }, - onClose: { - table: { - disable: true, - }, - }, - }, - args: { - description: - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus nunc massa, sollicitudin eget ex eget, pellentesque ultrices felis.', - variant: VariantTypes.DEFAULT, - effect: EffectTypes.LIGHT, - center: false, - closable: false, - onClose: fn(), - }, - excludeStories: /.*Data$/, + component: FbAlert, + title: "Components/Feedback/Alert", + argTypes: { + title: { + type: { name: "string", required: false }, + control: { type: "text" }, + description: "content of the alert title", + table: { + type: { summary: "string" }, + defaultValue: { summary: "-" }, + }, + }, + description: { + type: { name: "string", required: false }, + control: { type: "text" }, + description: "content of the alert description", + table: { + type: { summary: "string" }, + defaultValue: { summary: "-" }, + }, + }, + icon: { + type: { name: "string", required: false }, + control: { type: "text" }, + description: "slot for inserting custom icon. this slot will override default component icon", + table: { + type: { summary: "string" }, + defaultValue: { summary: "-" }, + }, + }, + default: { + type: { name: "string", required: false }, + control: { type: "text" }, + description: "slot for inserting custom content. This slot will override `title` and `description` slots", + table: { + type: { summary: "string" }, + defaultValue: { summary: "-" }, + }, + }, + variant: { + type: { name: "string", required: false }, + control: { type: "select" }, + options: [VariantTypes.DEFAULT, VariantTypes.PRIMARY, VariantTypes.INFO, VariantTypes.SUCCESS, VariantTypes.WARNING, VariantTypes.ERROR], + description: "alert variant", + table: { + type: { summary: "string" }, + defaultValue: { summary: VariantTypes.DEFAULT }, + }, + }, + effect: { + type: { name: "string", required: false }, + control: { type: "select" }, + options: [EffectTypes.LIGHT, EffectTypes.DARK], + description: "alert theme style", + table: { + type: { summary: "string" }, + defaultValue: { summary: EffectTypes.LIGHT }, + }, + }, + center: { + type: { name: "boolean", required: false }, + control: { type: "boolean" }, + description: "whether content is placed in the center", + table: { + type: { summary: "boolean" }, + defaultValue: { summary: false }, + }, + }, + closable: { + type: { name: "boolean", required: false }, + control: { type: "boolean" }, + description: "whether alert can be dismissed", + table: { + type: { summary: "boolean" }, + defaultValue: { summary: false }, + }, + }, + closeText: { + type: { name: "string", required: false }, + control: { type: "text" }, + description: "customized close button text", + table: { + type: { summary: "string" }, + defaultValue: { summary: undefined }, + }, + }, + onClose: { + table: { + disable: true, + }, + }, + }, + args: { + description: + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus nunc massa, sollicitudin eget ex eget, pellentesque ultrices felis.", + variant: VariantTypes.DEFAULT, + effect: EffectTypes.LIGHT, + center: false, + closable: false, + onClose: fn(), + }, + excludeStories: /.*Data$/, }; export const actionsData = { - onClose: action('close'), + onClose: action("close"), }; export default meta; @@ -120,17 +120,17 @@ export default meta; type Story = StoryObj; export const Component: Story = { - tags: ['hideInSidebar'], - args: { - description: 'A simple default alert — check it out!', - }, + tags: ["hideInSidebar"], + args: { + description: "A simple default alert — check it out!", + }, }; export const BasicUsage: Story = { - parameters: { - docs: { - source: { - code: ` + parameters: { + docs: { + source: { + code: ` `, - }, - }, - }, - tags: ['hideInSidebar'], - render: () => ({ - components: { FbAlert }, - template: ` + }, + }, + }, + tags: ["hideInSidebar"], + render: () => ({ + components: { FbAlert }, + template: `
@@ -182,14 +182,14 @@ export const BasicUsage: Story = {
`, - }), + }), }; export const Dark: Story = { - parameters: { - docs: { - source: { - code: ` + parameters: { + docs: { + source: { + code: ` `, - }, - }, - }, - tags: ['hideInSidebar'], - render: () => ({ - components: { FbAlert }, - template: ` + }, + }, + }, + tags: ["hideInSidebar"], + render: () => ({ + components: { FbAlert }, + template: `
@@ -241,14 +241,14 @@ export const Dark: Story = {
`, - }), + }), }; export const CloseButton: Story = { - parameters: { - docs: { - source: { - code: ` + parameters: { + docs: { + source: { + code: `