Skip to content

Commit

Permalink
feat: add Overlay docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladeeg committed Jul 2, 2024
1 parent 2304e0d commit e4b972b
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 5 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@gravity-ui/date-components": "^2.0.1",
"@gravity-ui/icons": "^2.8.1",
"@gravity-ui/page-constructor": "^5.2.0",
"@gravity-ui/uikit": "^6.17.0",
"@gravity-ui/uikit": "^6.20.0",
"@mdx-js/mdx": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@octokit/rest": "^20.1.1",
Expand Down
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: 'select',
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 e4b972b

Please sign in to comment.