From ff2b6c55cc691f0b62396d9ba481c75fc870cd6a Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 7 Apr 2022 14:18:18 +0200 Subject: chore: add a Tooltip component --- src/components/molecules/modals/modal.module.scss | 21 ++++++++ src/components/molecules/modals/modal.stories.tsx | 56 +++++++++++++++++++++ src/components/molecules/modals/modal.test.tsx | 9 ++++ src/components/molecules/modals/modal.tsx | 48 ++++++++++++++++++ .../molecules/modals/tooltip.module.scss | 46 +++++++++++++++++ .../molecules/modals/tooltip.stories.tsx | 41 ++++++++++++++++ src/components/molecules/modals/tooltip.test.tsx | 24 +++++++++ src/components/molecules/modals/tooltip.tsx | 57 ++++++++++++++++++++++ 8 files changed, 302 insertions(+) create mode 100644 src/components/molecules/modals/modal.module.scss create mode 100644 src/components/molecules/modals/modal.stories.tsx create mode 100644 src/components/molecules/modals/modal.test.tsx create mode 100644 src/components/molecules/modals/modal.tsx create mode 100644 src/components/molecules/modals/tooltip.module.scss create mode 100644 src/components/molecules/modals/tooltip.stories.tsx create mode 100644 src/components/molecules/modals/tooltip.test.tsx create mode 100644 src/components/molecules/modals/tooltip.tsx (limited to 'src/components/molecules/modals') diff --git a/src/components/molecules/modals/modal.module.scss b/src/components/molecules/modals/modal.module.scss new file mode 100644 index 0000000..2fff562 --- /dev/null +++ b/src/components/molecules/modals/modal.module.scss @@ -0,0 +1,21 @@ +@use "@styles/abstracts/functions" as fun; + +.wrapper { + padding: var(--spacing-md); + background: var(--color-bg-secondary); + border: fun.convert-px(4) solid; + border-image: radial-gradient( + ellipse at top, + var(--color-primary-lighter) 20%, + var(--color-primary) 100% + ) + 1; + box-shadow: fun.convert-px(2) fun.convert-px(-2) fun.convert-px(3) + fun.convert-px(-1) var(--color-shadow-dark); +} + +.icon { + --icon-size: #{fun.convert-px(30)}; + + margin-right: var(--spacing-2xs); +} diff --git a/src/components/molecules/modals/modal.stories.tsx b/src/components/molecules/modals/modal.stories.tsx new file mode 100644 index 0000000..b68a24b --- /dev/null +++ b/src/components/molecules/modals/modal.stories.tsx @@ -0,0 +1,56 @@ +import { ComponentMeta, ComponentStory } from '@storybook/react'; +import ModalComponent from './modal'; + +export default { + title: 'Molecules/Modals', + component: ModalComponent, + argTypes: { + children: { + control: { + type: 'text', + }, + description: 'The modal body.', + type: { + name: 'string', + required: true, + }, + }, + icon: { + control: { + type: 'select', + }, + description: 'The title icon.', + options: ['', 'cogs', 'search'], + table: { + category: 'Options', + }, + type: { + name: 'string', + required: false, + }, + }, + title: { + control: { + type: 'text', + }, + description: 'The modal title.', + table: { + category: 'Options', + }, + type: { + name: 'string', + required: false, + }, + }, + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ( + +); + +export const Modal = Template.bind({}); +Modal.args = { + children: + 'Inventore natus dignissimos aut illum modi asperiores. Et voluptatibus delectus.', +}; diff --git a/src/components/molecules/modals/modal.test.tsx b/src/components/molecules/modals/modal.test.tsx new file mode 100644 index 0000000..14fb224 --- /dev/null +++ b/src/components/molecules/modals/modal.test.tsx @@ -0,0 +1,9 @@ +import { render, screen } from '@test-utils'; +import Modal from './modal'; + +describe('Modal', () => { + it('renders a title', () => { + render(); + expect(screen.getByText('A custom title')).toBeInTheDocument(); + }); +}); diff --git a/src/components/molecules/modals/modal.tsx b/src/components/molecules/modals/modal.tsx new file mode 100644 index 0000000..4dc3b0a --- /dev/null +++ b/src/components/molecules/modals/modal.tsx @@ -0,0 +1,48 @@ +import Heading from '@components/atoms/headings/heading'; +import dynamic from 'next/dynamic'; +import { FC, ReactNode } from 'react'; +import styles from './modal.module.scss'; + +export type Icons = 'cogs' | 'search'; + +export type ModalProps = { + icon?: Icons; + title?: string; +}; + +const CogIcon = dynamic(() => import('@components/atoms/icons/cog')); +const SearchIcon = dynamic( + () => import('@components/atoms/icons/magnifying-glass') +); + +/** + * Modal component + * + * Render a modal component with an optional title and icon. + */ +const Modal: FC = ({ children, icon, title }) => { + const getIcon = (id: Icons) => { + switch (id) { + case 'cogs': + return ; + case 'search': + return ; + default: + return <>; + } + }; + + return ( +
+ {title && ( + + {icon && {getIcon(icon)}} + {title} + + )} + {children} +
+ ); +}; + +export default Modal; diff --git a/src/components/molecules/modals/tooltip.module.scss b/src/components/molecules/modals/tooltip.module.scss new file mode 100644 index 0000000..94aa3dd --- /dev/null +++ b/src/components/molecules/modals/tooltip.module.scss @@ -0,0 +1,46 @@ +@use "@styles/abstracts/functions" as fun; + +.wrapper { + --title-height: #{fun.convert-px(40)}; + + margin-top: calc(var(--title-height) / 2); + padding: calc((var(--title-height) / 2) + var(--spacing-sm)) var(--spacing-sm) + var(--spacing-sm); + position: relative; + background: var(--color-bg); + border: fun.convert-px(2) solid var(--color-primary-dark); + border-radius: fun.convert-px(3); + box-shadow: fun.convert-px(1) fun.convert-px(1) 0 0 var(--color-shadow), + fun.convert-px(2) fun.convert-px(2) fun.convert-px(1) fun.convert-px(1) + var(--color-shadow-light); +} + +.title { + display: flex; + align-items: center; + height: var(--title-height); + padding-right: var(--spacing-xs); + position: absolute; + top: calc(var(--title-height) / -2); + left: var(--spacing-xs); + background: var(--color-bg); + border: fun.convert-px(1) solid var(--color-primary-dark); + box-shadow: fun.convert-px(1) fun.convert-px(1) 0 0 var(--color-shadow); + color: var(--color-primary-darker); + font-size: var(--font-size-sm); + font-variant: small-caps; + font-weight: 500; +} + +.icon { + display: flex; + align-items: center; + height: var(--title-height); + margin-right: var(--spacing-xs); + padding: 0 var(--spacing-2xs); + background: var(--color-primary-dark); + border: fun.convert-px(1) solid var(--color-primary-dark); + box-shadow: fun.convert-px(1) fun.convert-px(1) 0 0 var(--color-shadow); + color: var(--color-fg-inverted); + font-weight: 600; +} diff --git a/src/components/molecules/modals/tooltip.stories.tsx b/src/components/molecules/modals/tooltip.stories.tsx new file mode 100644 index 0000000..a57cf34 --- /dev/null +++ b/src/components/molecules/modals/tooltip.stories.tsx @@ -0,0 +1,41 @@ +import { ComponentMeta, ComponentStory } from '@storybook/react'; +import TooltipComponent from './tooltip'; + +export default { + title: 'Molecules/Modals', + component: TooltipComponent, + argTypes: { + content: { + control: { + type: 'text', + }, + description: 'The tooltip body.', + type: { + name: 'string', + required: true, + }, + }, + title: { + control: { + type: 'text', + }, + description: 'The tooltip title', + type: { + name: 'string', + required: true, + }, + }, + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ( + +); + +export const Tooltip = Template.bind({}); +Tooltip.args = { + content: + 'Minima tempora fuga omnis ratione doloribus ut. Totam ea vitae consequatur. Fuga hic ipsum. In non debitis ex assumenda ut dicta. Sit ut maxime eligendi est.', + icon: '?', + title: 'Laborum enim vero', +}; diff --git a/src/components/molecules/modals/tooltip.test.tsx b/src/components/molecules/modals/tooltip.test.tsx new file mode 100644 index 0000000..24f20d8 --- /dev/null +++ b/src/components/molecules/modals/tooltip.test.tsx @@ -0,0 +1,24 @@ +import { render, screen } from '@test-utils'; +import Tooltip from './tooltip'; + +const title = 'Illum eum at'; +const content = + 'Non accusantium ad. Est et impedit iste animi voluptas cum accusamus accusantium. Repellat ut sint pariatur cumque cupiditate. Animi occaecati odio ut debitis ipsam similique. Repudiandae aut earum occaecati consequatur laborum ut nobis iusto. Adipisci laboriosam id.'; +const icon = '?'; + +describe('Tooltip', () => { + it('renders a title', () => { + render(); + expect(screen.getByText(title)).toBeInTheDocument(); + }); + + it('renders an explanation', () => { + render(); + expect(screen.getByText(content)).toBeInTheDocument(); + }); + + it('renders an icon', () => { + render(); + expect(screen.getByText(icon)).toBeInTheDocument(); + }); +}); diff --git a/src/components/molecules/modals/tooltip.tsx b/src/components/molecules/modals/tooltip.tsx new file mode 100644 index 0000000..ceb0b14 --- /dev/null +++ b/src/components/molecules/modals/tooltip.tsx @@ -0,0 +1,57 @@ +import List, { type ListItem } from '@components/atoms/lists/list'; +import { FC, ReactNode } from 'react'; +import styles from './tooltip.module.scss'; + +export type TooltipProps = { + /** + * Set additional classes to the tooltip wrapper. + */ + classes?: string; + /** + * The tooltip body. + */ + content: string | string[]; + /** + * An icon to illustrate tooltip content. + */ + icon: ReactNode; + /** + * The tooltip title. + */ + title: string; +}; + +/** + * Tooltip component + * + * Render a tooltip modal. + */ +const Tooltip: FC = ({ classes = '', content, icon, title }) => { + /** + * Format an array of strings to an array of object with id and value. + * + * @param {string[]} array - An array of strings. + * @returns {ListItem[]} The array formatted to be used as list items. + */ + const getListItems = (array: string[]): ListItem[] => { + return array.map((string, index) => { + return { id: `item-${index}`, value: string }; + }); + }; + + return ( +
+
+ {icon} + {title} +
+ {Array.isArray(content) ? ( + + ) : ( + content + )} +
+ ); +}; + +export default Tooltip; -- cgit v1.2.3 From a5df28fad0dae266a857ae110c43b3cb8b23c996 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 8 Apr 2022 19:41:40 +0200 Subject: refactor: use a consistent classname prop and avoid children prop I was using the FunctionComponent type for some component that do not use children. So I change the type to VoidFunctionComponent to avoid mistakes. I also rename all the "classes" or "additionalClasses" props to "className" to keep consistency between each components. --- src/components/atoms/buttons/button-link.tsx | 2 +- src/components/atoms/buttons/button.stories.tsx | 13 +++++++++++ src/components/atoms/buttons/button.tsx | 10 ++++----- src/components/atoms/buttons/buttons.module.scss | 4 ++++ src/components/atoms/forms/toggle.module.scss | 3 ++- src/components/atoms/forms/toggle.stories.tsx | 14 ++++++++++++ src/components/atoms/forms/toggle.tsx | 26 ++++++++++++++++------ src/components/atoms/headings/heading.stories.tsx | 14 ++++++------ src/components/atoms/headings/heading.tsx | 14 +++++++----- src/components/atoms/images/logo.stories.tsx | 15 +++++++++++++ src/components/atoms/images/logo.tsx | 4 ++-- src/components/atoms/links/link.stories.tsx | 13 +++++++++++ src/components/atoms/links/link.tsx | 14 +++++------- src/components/atoms/links/nav-link.tsx | 4 ++-- src/components/atoms/links/sharing-link.tsx | 4 ++-- src/components/atoms/links/social-link.tsx | 10 +++++---- .../atoms/lists/description-list.stories.tsx | 6 ++--- src/components/atoms/lists/description-list.tsx | 13 ++++++----- src/components/atoms/lists/list.stories.tsx | 6 ++--- src/components/atoms/lists/list.tsx | 15 +++++-------- .../atoms/loaders/progress-bar.stories.tsx | 8 ++++++- src/components/atoms/loaders/progress-bar.tsx | 10 ++++----- src/components/atoms/loaders/spinner.stories.tsx | 3 +++ src/components/atoms/loaders/spinner.tsx | 6 ++--- .../molecules/buttons/back-to-top.stories.tsx | 7 ++++-- src/components/molecules/buttons/back-to-top.tsx | 12 +++++----- .../molecules/buttons/help-button.stories.tsx | 4 ++-- src/components/molecules/buttons/help-button.tsx | 10 ++++----- .../molecules/images/responsive-image.tsx | 6 ++--- src/components/molecules/layout/branding.tsx | 10 ++++----- .../molecules/layout/flipping-logo.stories.tsx | 23 ++++++++++++++----- src/components/molecules/layout/flipping-logo.tsx | 12 +++++----- src/components/molecules/modals/modal.stories.tsx | 13 +++++++++++ src/components/molecules/modals/modal.tsx | 22 +++++++++++++----- .../molecules/modals/tooltip.stories.tsx | 23 +++++++++++++++++++ src/components/molecules/modals/tooltip.tsx | 15 ++++++++----- 36 files changed, 270 insertions(+), 118 deletions(-) (limited to 'src/components/molecules/modals') diff --git a/src/components/atoms/buttons/button-link.tsx b/src/components/atoms/buttons/button-link.tsx index 47fe4b0..81229c8 100644 --- a/src/components/atoms/buttons/button-link.tsx +++ b/src/components/atoms/buttons/button-link.tsx @@ -2,7 +2,7 @@ import Link from 'next/link'; import { FC } from 'react'; import styles from './buttons.module.scss'; -type ButtonLinkProps = { +export type ButtonLinkProps = { /** * ButtonLink accessible label. */ diff --git a/src/components/atoms/buttons/button.stories.tsx b/src/components/atoms/buttons/button.stories.tsx index 9f4061b..1061d83 100644 --- a/src/components/atoms/buttons/button.stories.tsx +++ b/src/components/atoms/buttons/button.stories.tsx @@ -33,6 +33,19 @@ export default { required: true, }, }, + className: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the button wrapper.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, disabled: { control: { type: 'boolean', diff --git a/src/components/atoms/buttons/button.tsx b/src/components/atoms/buttons/button.tsx index ae4c894..b223046 100644 --- a/src/components/atoms/buttons/button.tsx +++ b/src/components/atoms/buttons/button.tsx @@ -3,9 +3,9 @@ import styles from './buttons.module.scss'; export type ButtonProps = { /** - * Add additional classes to the button wrapper. + * Set additional classnames to the button wrapper. */ - additionalClasses?: string; + className?: string; /** * Button accessible label. */ @@ -17,7 +17,7 @@ export type ButtonProps = { /** * Button kind. Default: secondary. */ - kind?: 'primary' | 'secondary' | 'tertiary'; + kind?: 'primary' | 'secondary' | 'tertiary' | 'neutral'; /** * A callback function to handle click. */ @@ -38,7 +38,7 @@ export type ButtonProps = { * Use a button as call to action. */ const Button: FC = ({ - additionalClasses, + className = '', ariaLabel, children, disabled = false, @@ -54,7 +54,7 @@ const Button: FC = ({ ); }; -export const Button = Template.bind({}); +/** + * Button Story - Primary + */ +export const Primary = Template.bind({}); +Primary.args = { + kind: 'primary', +}; + +/** + * Button Story - Secondary + */ +export const Secondary = Template.bind({}); +Secondary.args = { + kind: 'secondary', +}; + +/** + * Button Story - Tertiary + */ +export const Tertiary = Template.bind({}); +Tertiary.args = { + kind: 'tertiary', +}; diff --git a/src/components/atoms/buttons/buttons.module.scss b/src/components/atoms/buttons/buttons.module.scss index 8e3e196..36c66b6 100644 --- a/src/components/atoms/buttons/buttons.module.scss +++ b/src/components/atoms/buttons/buttons.module.scss @@ -8,6 +8,7 @@ border-radius: fun.convert-px(5); font-size: var(--font-size-md); font-weight: 600; + text-decoration: none; transition: all 0.3s ease-in-out 0s; &--initial { @@ -44,7 +45,6 @@ fun.convert-px(2) fun.convert-px(2) 0 fun.convert-px(3) var(--color-primary-dark); color: var(--color-fg-inverted); - text-decoration: none; text-shadow: fun.convert-px(2) fun.convert-px(2) 0 var(--color-shadow); &:disabled { @@ -91,7 +91,6 @@ fun.convert-px(3) fun.convert-px(4) fun.convert-px(5) fun.convert-px(-4) var(--color-shadow); color: var(--color-primary); - text-decoration: underline transparent 0; &:disabled { border-color: var(--color-border-dark); @@ -122,7 +121,7 @@ border-color: var(--color-primary-dark); box-shadow: 0 0 0 0 var(--color-shadow); color: var(--color-primary-dark); - text-decoration: underline transparent 0; + text-decoration: none; transform: scale(var(--scale-down, 0.94)); } } diff --git a/src/components/atoms/forms/checkbox.stories.tsx b/src/components/atoms/forms/checkbox.stories.tsx index 7faf343..588fdcc 100644 --- a/src/components/atoms/forms/checkbox.stories.tsx +++ b/src/components/atoms/forms/checkbox.stories.tsx @@ -2,6 +2,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { useState } from 'react'; import CheckboxComponent from './checkbox'; +/** + * Checkbox - Storybook Meta + */ export default { title: 'Atoms/Forms', component: CheckboxComponent, @@ -88,6 +91,9 @@ const Template: ComponentStory = ({ ); }; +/** + * Checkbox Story + */ export const Checkbox = Template.bind({}); Checkbox.args = { id: 'storybook-checkbox', diff --git a/src/components/atoms/forms/field.stories.tsx b/src/components/atoms/forms/field.stories.tsx index ec81922..00a183d 100644 --- a/src/components/atoms/forms/field.stories.tsx +++ b/src/components/atoms/forms/field.stories.tsx @@ -1,14 +1,16 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { useState } from 'react'; -import FieldComponent from './field'; +import Field from './field'; +/** + * Field - Storybook Meta + */ export default { - title: 'Atoms/Forms', - component: FieldComponent, + title: 'Atoms/Forms/Fields', + component: Field, args: { disabled: false, required: false, - type: 'text', }, argTypes: { 'aria-labelledby': { @@ -182,20 +184,74 @@ export default { }, }, }, -} as ComponentMeta; +} as ComponentMeta; -const Template: ComponentStory = ({ +const Template: ComponentStory = ({ value: _value, setValue: _setValue, ...args }) => { const [value, setValue] = useState(''); - return ; + return ; }; -export const Field = Template.bind({}); -Field.args = { +/** + * Field Story - DateTime + */ +export const DateTime = Template.bind({}); +DateTime.args = { id: 'field-storybook', name: 'field-storybook', + type: 'datetime-local', +}; + +/** + * Field Story - Email + */ +export const Email = Template.bind({}); +Email.args = { + id: 'field-storybook', + name: 'field-storybook', + type: 'email', +}; + +/** + * Field Story - Text + */ +export const Text = Template.bind({}); +Text.args = { + id: 'field-storybook', + name: 'field-storybook', + type: 'text', +}; + +/** + * Field Story - Number + */ +export const Number = Template.bind({}); +Number.args = { + id: 'field-storybook', + name: 'field-storybook', + type: 'number', +}; + +/** + * Field Story - TextArea + */ +export const TextArea = Template.bind({}); +TextArea.args = { + id: 'field-storybook', + name: 'field-storybook', + type: 'textarea', +}; + +/** + * Field Story - Time + */ +export const Time = Template.bind({}); +Time.args = { + id: 'field-storybook', + name: 'field-storybook', + type: 'time', }; diff --git a/src/components/atoms/forms/label.stories.tsx b/src/components/atoms/forms/label.stories.tsx index 463e8ac..79f1a34 100644 --- a/src/components/atoms/forms/label.stories.tsx +++ b/src/components/atoms/forms/label.stories.tsx @@ -1,6 +1,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import LabelComponent from './label'; +/** + * Label - Storybook Meta + */ export default { title: 'Atoms/Forms', component: LabelComponent, @@ -79,6 +82,9 @@ const Template: ComponentStory = ({ ...args }) => {children}; +/** + * Label Story + */ export const Label = Template.bind({}); Label.args = { children: 'A label', diff --git a/src/components/atoms/forms/select.stories.tsx b/src/components/atoms/forms/select.stories.tsx index c2fb8c6..7127597 100644 --- a/src/components/atoms/forms/select.stories.tsx +++ b/src/components/atoms/forms/select.stories.tsx @@ -8,6 +8,9 @@ const selectOptions = [ { id: 'option3', name: 'Option 3', value: 'option3' }, ]; +/** + * Select - Storybook Meta + */ export default { title: 'Atoms/Forms', component: SelectComponent, @@ -136,6 +139,9 @@ const Template: ComponentStory = ({ return ; }; +/** + * Select Story + */ export const Select = Template.bind({}); Select.args = { id: 'storybook-select', diff --git a/src/components/atoms/headings/heading.stories.tsx b/src/components/atoms/headings/heading.stories.tsx index 66a84dc..da5a718 100644 --- a/src/components/atoms/headings/heading.stories.tsx +++ b/src/components/atoms/headings/heading.stories.tsx @@ -1,9 +1,12 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import HeadingComponent from './heading'; +import Heading from './heading'; +/** + * Heading - Storybook Meta + */ export default { - title: 'Atoms/Headings', - component: HeadingComponent, + title: 'Atoms/Typography/Headings', + component: Heading, args: { isFake: false, withMargin: true, @@ -45,10 +48,11 @@ export default { }, level: { control: { - type: 'select', + type: 'number', + min: 1, + max: 6, }, description: 'Heading level.', - options: [1, 2, 3, 4, 5, 6], type: { name: 'number', required: true, @@ -69,14 +73,62 @@ export default { }, }, }, -} as ComponentMeta; +} as ComponentMeta; -const Template: ComponentStory = (args) => ( - +const Template: ComponentStory = (args) => ( + ); -export const Heading = Template.bind({}); -Heading.args = { +/** + * Heading Story - h1 + */ +export const H1 = Template.bind({}); +H1.args = { children: 'Your title', level: 1, }; + +/** + * Heading Story - h2 + */ +export const H2 = Template.bind({}); +H2.args = { + children: 'Your title', + level: 2, +}; + +/** + * Heading Story - h3 + */ +export const H3 = Template.bind({}); +H3.args = { + children: 'Your title', + level: 3, +}; + +/** + * Heading Story - h4 + */ +export const H4 = Template.bind({}); +H4.args = { + children: 'Your title', + level: 4, +}; + +/** + * Heading Story - h5 + */ +export const H5 = Template.bind({}); +H5.args = { + children: 'Your title', + level: 5, +}; + +/** + * Heading Story - h6 + */ +export const H6 = Template.bind({}); +H6.args = { + children: 'Your title', + level: 6, +}; diff --git a/src/components/atoms/icons/arrow.stories.tsx b/src/components/atoms/icons/arrow.stories.tsx index 96ce1d8..1941479 100644 --- a/src/components/atoms/icons/arrow.stories.tsx +++ b/src/components/atoms/icons/arrow.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import ArrowIcon from './arrow'; +/** + * Arrow icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: ArrowIcon, argTypes: { className: { @@ -36,6 +39,9 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Arrow + */ export const Arrow = Template.bind({}); Arrow.args = { direction: 'right', diff --git a/src/components/atoms/icons/career.stories.tsx b/src/components/atoms/icons/career.stories.tsx index 8575cb9..7b11bb8 100644 --- a/src/components/atoms/icons/career.stories.tsx +++ b/src/components/atoms/icons/career.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import CareerIcon from './career'; +/** + * Career icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: CareerIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Career + */ export const Career = Template.bind({}); diff --git a/src/components/atoms/icons/cc-by-sa.stories.tsx b/src/components/atoms/icons/cc-by-sa.stories.tsx index 21d6cd5..f2bc8f0 100644 --- a/src/components/atoms/icons/cc-by-sa.stories.tsx +++ b/src/components/atoms/icons/cc-by-sa.stories.tsx @@ -2,8 +2,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { IntlProvider } from 'react-intl'; import CCBySAIcon from './cc-by-sa'; +/** + * CC BY SA icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: CCBySAIcon, argTypes: { className: { @@ -20,12 +23,20 @@ export default { }, }, }, + decorators: [ + (Story) => ( + + + + ), + ], } as ComponentMeta; const Template: ComponentStory = (args) => ( - - - + ); +/** + * Icons Stories - CC BY SA + */ export const CCBySA = Template.bind({}); diff --git a/src/components/atoms/icons/close.stories.tsx b/src/components/atoms/icons/close.stories.tsx index b1d88cd..f9628db 100644 --- a/src/components/atoms/icons/close.stories.tsx +++ b/src/components/atoms/icons/close.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import CloseIcon from './close'; +/** + * Close icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: CloseIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Close + */ export const Close = Template.bind({}); diff --git a/src/components/atoms/icons/cog.stories.tsx b/src/components/atoms/icons/cog.stories.tsx index ee883d8..631f30d 100644 --- a/src/components/atoms/icons/cog.stories.tsx +++ b/src/components/atoms/icons/cog.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import CogIcon from './cog'; +/** + * Cogs icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: CogIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Cogs + */ export const Cog = Template.bind({}); diff --git a/src/components/atoms/icons/computer-screen.stories.tsx b/src/components/atoms/icons/computer-screen.stories.tsx index 46e3ad4..19649ad 100644 --- a/src/components/atoms/icons/computer-screen.stories.tsx +++ b/src/components/atoms/icons/computer-screen.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import ComputerScreenIcon from './computer-screen'; +/** + * Computer Screen icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: ComputerScreenIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Computer Screen + */ export const ComputerScreen = Template.bind({}); diff --git a/src/components/atoms/icons/envelop.stories.tsx b/src/components/atoms/icons/envelop.stories.tsx index 9139b44..efa94dd 100644 --- a/src/components/atoms/icons/envelop.stories.tsx +++ b/src/components/atoms/icons/envelop.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import EnvelopIcon from './envelop'; +/** + * Envelop icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: EnvelopIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Envelop + */ export const Envelop = Template.bind({}); diff --git a/src/components/atoms/icons/hamburger.stories.tsx b/src/components/atoms/icons/hamburger.stories.tsx index c753e69..0a8a8cc 100644 --- a/src/components/atoms/icons/hamburger.stories.tsx +++ b/src/components/atoms/icons/hamburger.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import HamburgerIcon from './hamburger'; +/** + * Hamburger icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: HamburgerIcon, argTypes: { className: { @@ -38,4 +41,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Hamburger + */ export const Hamburger = Template.bind({}); diff --git a/src/components/atoms/icons/home.stories.tsx b/src/components/atoms/icons/home.stories.tsx index b1c995c..ffb3061 100644 --- a/src/components/atoms/icons/home.stories.tsx +++ b/src/components/atoms/icons/home.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import HomeIcon from './home'; +/** + * Home icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: HomeIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Home + */ export const Home = Template.bind({}); diff --git a/src/components/atoms/icons/magnifying-glass.stories.tsx b/src/components/atoms/icons/magnifying-glass.stories.tsx index 80e183e..3e33deb 100644 --- a/src/components/atoms/icons/magnifying-glass.stories.tsx +++ b/src/components/atoms/icons/magnifying-glass.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import MagnifyingGlassIcon from './magnifying-glass'; +/** + * Magnifying Glass icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: MagnifyingGlassIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Magnifying Glass + */ export const MagnifyingGlass = Template.bind({}); diff --git a/src/components/atoms/icons/moon.stories.tsx b/src/components/atoms/icons/moon.stories.tsx index 4d2fb9a..e8b34de 100644 --- a/src/components/atoms/icons/moon.stories.tsx +++ b/src/components/atoms/icons/moon.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import MoonIcon from './moon'; +/** + * Moon icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: MoonIcon, argTypes: { className: { @@ -38,4 +41,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Moon + */ export const Moon = Template.bind({}); diff --git a/src/components/atoms/icons/plus-minus.stories.tsx b/src/components/atoms/icons/plus-minus.stories.tsx index ffa28f2..f7e55f8 100644 --- a/src/components/atoms/icons/plus-minus.stories.tsx +++ b/src/components/atoms/icons/plus-minus.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import PlusMinusIcon from './plus-minus'; +/** + * Plus/Minus icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: PlusMinusIcon, argTypes: { className: { @@ -37,6 +40,9 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Plus/Minus + */ export const PlusMinus = Template.bind({}); PlusMinus.args = { state: 'plus', diff --git a/src/components/atoms/icons/posts-stack.stories.tsx b/src/components/atoms/icons/posts-stack.stories.tsx index 46bb39f..1990b98 100644 --- a/src/components/atoms/icons/posts-stack.stories.tsx +++ b/src/components/atoms/icons/posts-stack.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import PostsStackIcon from './posts-stack'; +/** + * Posts Stack icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: PostsStackIcon, argTypes: { className: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Posts Stack + */ export const PostsStack = Template.bind({}); diff --git a/src/components/atoms/icons/sun.stories.tsx b/src/components/atoms/icons/sun.stories.tsx index 23c5b27..60af648 100644 --- a/src/components/atoms/icons/sun.stories.tsx +++ b/src/components/atoms/icons/sun.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import SunIcon from './sun'; +/** + * Sun icon - Storybook Meta + */ export default { - title: 'Atoms/Icons', + title: 'Atoms/Illustrations/Icons', component: SunIcon, argTypes: { className: { @@ -38,4 +41,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Icons Stories - Sun + */ export const Sun = Template.bind({}); diff --git a/src/components/atoms/images/logo.stories.tsx b/src/components/atoms/images/logo.stories.tsx index fbc7501..458ec08 100644 --- a/src/components/atoms/images/logo.stories.tsx +++ b/src/components/atoms/images/logo.stories.tsx @@ -1,8 +1,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import LogoComponent from './logo'; +/** + * Logo - Storybook Meta + */ export default { - title: 'Atoms/Images', + title: 'Atoms/Illustrations/Images', component: LogoComponent, argTypes: { title: { @@ -25,4 +28,7 @@ const Template: ComponentStory = (args) => ( ); +/** + * Images Stories - Logo + */ export const Logo = Template.bind({}); diff --git a/src/components/atoms/layout/copyright.stories.tsx b/src/components/atoms/layout/copyright.stories.tsx index 3b315fa..b988165 100644 --- a/src/components/atoms/layout/copyright.stories.tsx +++ b/src/components/atoms/layout/copyright.stories.tsx @@ -3,6 +3,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { IntlProvider } from 'react-intl'; import CopyrightComponent from './copyright'; +/** + * Copyright - Storybook Meta + */ export default { title: 'Atoms/Layout', component: CopyrightComponent, @@ -36,14 +39,22 @@ export default { }, }, }, + decorators: [ + (Story) => ( + + + + ), + ], } as ComponentMeta; const Template: ComponentStory = (args) => ( - - - + ); +/** + * Layout Stories - Copyright + */ export const Copyright = Template.bind({}); Copyright.args = { dates: { diff --git a/src/components/atoms/layout/main.stories.tsx b/src/components/atoms/layout/main.stories.tsx index 64df890..5bde475 100644 --- a/src/components/atoms/layout/main.stories.tsx +++ b/src/components/atoms/layout/main.stories.tsx @@ -1,6 +1,9 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import MainComponent from './main'; +/** + * Main - Storybook Meta + */ export default { title: 'Atoms/Layout', component: MainComponent, @@ -45,6 +48,9 @@ const Template: ComponentStory = (args) => ( ); +/** + * Layout Stories - Main + */ export const Main = Template.bind({}); Main.args = { children: 'The main content.', diff --git a/src/components/atoms/layout/no-script.stories.tsx b/src/components/atoms/layout/no-script.stories.tsx index 474e2fb..22d2fea 100644 --- a/src/components/atoms/layout/no-script.stories.tsx +++ b/src/components/atoms/layout/no-script.stories.tsx @@ -1,9 +1,12 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import NoScriptComponent from './no-script'; +import NoScript from './no-script'; +/** + * NoScript - Storybook Meta + */ export default { - title: 'Atoms/Layout', - component: NoScriptComponent, + title: 'Atoms/Layout/NoScript', + component: NoScript, args: { position: 'initial', }, @@ -34,13 +37,26 @@ export default { }, }, }, -} as ComponentMeta; +} as ComponentMeta; -const Template: ComponentStory = (args) => ( - +const Template: ComponentStory = (args) => ( +