Skip to content

Commit

Permalink
feat: add Overlay docs (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladeeg authored Jul 8, 2024
1 parent 2e6d8ab commit e6bdca7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/content/components/uikit/Overlay/OverlayComponent.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Box position="relative">
<Flex
ref={anchorRef}
style={{
border: '2px dashed',
}}
width={100}
height={100}
color="var(--g-color-text-secondary)"
alignItems="center"
justifyContent="center"
>
Some text
</Flex>
<Overlay visible={visible} background={background}>
<Loader />
</Overlay>
</Box>
);
};
29 changes: 29 additions & 0 deletions src/content/components/uikit/Overlay/index.ts
Original file line number Diff line number Diff line change
@@ -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',
},
},
},
};
2 changes: 2 additions & 0 deletions src/content/components/uikit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -61,6 +62,7 @@ const uikitComponents: Component[] = [
loaderConfig,
menuConfig,
modalConfig,
overlayConfig,
paginationConfig,
paletteConfig,
pinInputConfig,
Expand Down

0 comments on commit e6bdca7

Please sign in to comment.