From 207be73ff15757685a1f15bb7e9efd3551e33cfd Mon Sep 17 00:00:00 2001 From: vladoseeg Date: Thu, 13 Jun 2024 19:00:54 +0300 Subject: [PATCH] fix(Overlay.stories): codestyle/docs fixes + remove unnecessary story --- src/components/Overlay/README.md | 12 +-- src/components/Overlay/__stories__/Docs.mdx | 2 +- ...rlayShowcase.scss => Overlay.stories.scss} | 2 +- ...owcase.stories.tsx => Overlay.stories.tsx} | 86 ++++++------------- 4 files changed, 32 insertions(+), 70 deletions(-) rename src/components/Overlay/__stories__/{OverlayShowcase.scss => Overlay.stories.scss} (88%) rename src/components/Overlay/__stories__/{OverlayShowcase.stories.tsx => Overlay.stories.tsx} (55%) diff --git a/src/components/Overlay/README.md b/src/components/Overlay/README.md index 709bce37f7..b913e64948 100644 --- a/src/components/Overlay/README.md +++ b/src/components/Overlay/README.md @@ -38,9 +38,9 @@ You can use `base` or `float` background colors. ## Properties -| Name | Type | Required | Default | Description | -| :--------- | :----------------- | :------: | :------ | :---------------------------------- | -| className | `String` | | | CSS class name of the root element | -| visible | `Boolean` | | `false` | Overlay visibility state | -| background | `"base"` `"float"` | | `base` | Overlay background style | -| children | `React.ReactNode` | | | Content, usually a Loader component | +| Name | Description | Type | Default | +| :--------- | :---------------------------------- | :----------------: | :-----: | +| className | CSS class name of the root element | `String` | | +| visible | Overlay visibility state | `Boolean` | `false` | +| background | Overlay background style | `"base"` `"float"` | `base` | +| children | Content, usually a Loader component | `React.ReactNode` | | diff --git a/src/components/Overlay/__stories__/Docs.mdx b/src/components/Overlay/__stories__/Docs.mdx index 85dfb38f27..a099505e89 100644 --- a/src/components/Overlay/__stories__/Docs.mdx +++ b/src/components/Overlay/__stories__/Docs.mdx @@ -1,5 +1,5 @@ import {Meta, Markdown} from '@storybook/addon-docs'; -import * as Stories from './OverlayShowcase.stories'; +import * as Stories from './Overlay.stories'; import Readme from '../README.md?raw'; diff --git a/src/components/Overlay/__stories__/OverlayShowcase.scss b/src/components/Overlay/__stories__/Overlay.stories.scss similarity index 88% rename from src/components/Overlay/__stories__/OverlayShowcase.scss rename to src/components/Overlay/__stories__/Overlay.stories.scss index ea07797b7f..93faf42c44 100644 --- a/src/components/Overlay/__stories__/OverlayShowcase.scss +++ b/src/components/Overlay/__stories__/Overlay.stories.scss @@ -1,6 +1,6 @@ @use '../../variables'; -$block: '.#{variables.$ns}overlay-showcase'; +$block: '.#{variables.$ns}overlay-stories'; #{$block} { &__content { diff --git a/src/components/Overlay/__stories__/OverlayShowcase.stories.tsx b/src/components/Overlay/__stories__/Overlay.stories.tsx similarity index 55% rename from src/components/Overlay/__stories__/OverlayShowcase.stories.tsx rename to src/components/Overlay/__stories__/Overlay.stories.tsx index be00fd433f..edfefbe88d 100644 --- a/src/components/Overlay/__stories__/OverlayShowcase.stories.tsx +++ b/src/components/Overlay/__stories__/Overlay.stories.tsx @@ -3,12 +3,13 @@ import React from 'react'; import {ArrowsRotateRight} from '@gravity-ui/icons'; import type {Meta, StoryObj} from '@storybook/react'; +import {Showcase} from '../../../demo/Showcase'; +import {ShowcaseItem} from '../../../demo/ShowcaseItem'; import {Button} from '../../Button'; -import {Dialog as DialogComponent} from '../../Dialog'; import {Icon} from '../../Icon'; import {Loader} from '../../Loader'; import {Table as TableComponent} from '../../Table'; -import {Box, Flex} from '../../layout'; +import {Box} from '../../layout'; import {block} from '../../utils/cn'; import {Overlay} from '../Overlay'; import type {OverlayProps} from '../Overlay'; @@ -16,9 +17,9 @@ import type {OverlayProps} from '../Overlay'; import {columns, data} from './data'; import type {DataItem} from './data'; -import './OverlayShowcase.scss'; +import './Overlay.stories.scss'; -const b = block('overlay-showcase'); +const b = block('overlay-stories'); type Story = StoryObj; @@ -33,7 +34,7 @@ export const Default: Story = { }, render: (args) => { return ( -
+
Example of overlay
with loader
@@ -58,7 +59,7 @@ export const Default: Story = {
without children
-
+ ); }, }; @@ -69,66 +70,27 @@ export const Background: Story = { }, render: (args) => { return ( -
- -
I am an example
-
content
- -
- - -
I am an example
-
content
- -
-
- ); - }, -}; - -export const DialogTemplate: Story = { - args: { - visible: true, - }, - render: (args) => { - const dialogTitleId = 'app-dialog-title'; - return ( - {}} - onEnterKeyDown={() => { - alert('onEnterKeyDown'); - }} - aria-labelledby={dialogTitleId} - > - - - - - Some text to show in dialog body - - - - - - - Loading text about process with long description to show -
max content-width -
-
-
+ + + +
I am an example
+
content
+ +
+
+ + +
I am an example
+
content
+
-
- alert('onApply')} - textButtonApply="Apply" - /> -
+ + ); }, }; -const TableShowcase = (args: OverlayProps) => { +const TableView = (args: OverlayProps) => { const [loading, setLoading] = React.useState(false); const [loadedData, setData] = React.useState([]); @@ -162,5 +124,5 @@ const TableShowcase = (args: OverlayProps) => { export const Table: Story = { args: {}, - render: TableShowcase, + render: TableView, };