From e6bdca77e20793d4ea4f08490f5bae7ba8eb23d6 Mon Sep 17 00:00:00 2001 From: Vladislav Marchenko Date: Mon, 8 Jul 2024 13:02:09 +0300 Subject: [PATCH] feat: add Overlay docs (#228) --- .../uikit/Overlay/OverlayComponent.tsx | 32 +++++++++++++++++++ src/content/components/uikit/Overlay/index.ts | 29 +++++++++++++++++ src/content/components/uikit/index.ts | 2 ++ 3 files changed, 63 insertions(+) create mode 100644 src/content/components/uikit/Overlay/OverlayComponent.tsx create mode 100644 src/content/components/uikit/Overlay/index.ts diff --git a/src/content/components/uikit/Overlay/OverlayComponent.tsx b/src/content/components/uikit/Overlay/OverlayComponent.tsx new file mode 100644 index 00000000000..551bcd148c8 --- /dev/null +++ b/src/content/components/uikit/Overlay/OverlayComponent.tsx @@ -0,0 +1,32 @@ +import {Box, Flex, Loader, Overlay} from '@gravity-ui/uikit'; +import React from 'react'; + +type OverlayComponentProps = { + visible?: boolean; + background?: 'base' | 'float'; +}; + +export const OverlayComponent = ({visible, background}: OverlayComponentProps) => { + const anchorRef = React.useRef(null); + + return ( + + + Some text + + + + + + ); +}; diff --git a/src/content/components/uikit/Overlay/index.ts b/src/content/components/uikit/Overlay/index.ts new file mode 100644 index 00000000000..b9efb6809ae --- /dev/null +++ b/src/content/components/uikit/Overlay/index.ts @@ -0,0 +1,29 @@ +import dynamic from 'next/dynamic'; + +import {Repos} from '../../../../types/common'; +import {getGithubUrl, getReadmeUrl, mappingOptions} from '../../utils'; + +const getterOptions = {repoName: Repos.Uikit, componentName: 'Overlay'}; + +export const overlayConfig = { + id: 'overlay', + title: 'Overlay', + githubUrl: getGithubUrl(getterOptions), + content: { + readmeUrl: getReadmeUrl(getterOptions), + }, + sandbox: { + component: dynamic(() => import('./OverlayComponent').then((mod) => mod.OverlayComponent)), + props: { + visible: { + type: 'switch', + defaultValue: true, + }, + background: { + type: 'radioButton', + values: mappingOptions(['base', 'float']), + defaultValue: 'base', + }, + }, + }, +}; diff --git a/src/content/components/uikit/index.ts b/src/content/components/uikit/index.ts index 29e303f6863..4c85aa181ae 100644 --- a/src/content/components/uikit/index.ts +++ b/src/content/components/uikit/index.ts @@ -18,6 +18,7 @@ import {listConfig} from './List'; import {loaderConfig} from './Loader'; import {menuConfig} from './Menu'; import {modalConfig} from './Modal'; +import {overlayConfig} from './Overlay'; import {paginationConfig} from './Pagination'; import {paletteConfig} from './Palette'; import {pinInputConfig} from './PinInput'; @@ -61,6 +62,7 @@ const uikitComponents: Component[] = [ loaderConfig, menuConfig, modalConfig, + overlayConfig, paginationConfig, paletteConfig, pinInputConfig,