Skip to content

Commit 57cb424

Browse files
authored
feat(Popover): add popover docs (#507)
1 parent 3833dd9 commit 57cb424

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {Button, Popover} from '@gravity-ui/uikit';
2+
import type {PopoverProps} from '@gravity-ui/uikit';
3+
import React from 'react';
4+
5+
type PopupComponentProps = {
6+
open?: boolean;
7+
placement?: PopoverProps['placement'];
8+
hasArrow?: boolean;
9+
disabled?: boolean;
10+
trigger?: PopoverProps['trigger'];
11+
};
12+
13+
export const PopoverComponent = ({disabled, trigger, placement, hasArrow}: PopupComponentProps) => {
14+
return (
15+
<Popover
16+
content="Content"
17+
disabled={disabled}
18+
trigger={trigger}
19+
placement={placement}
20+
hasArrow={hasArrow}
21+
>
22+
<Button>{trigger} me</Button>
23+
</Popover>
24+
);
25+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import dynamic from 'next/dynamic';
2+
3+
import {Repos} from '../../../../types/common';
4+
import {getGithubUrl, getReadmeUrl, mappingOptions} from '../../utils';
5+
6+
const getterOptions = {repoName: Repos.Uikit, componentName: 'Popover'};
7+
8+
export const popoverConfig = {
9+
id: 'popover',
10+
title: 'Popover',
11+
githubUrl: getGithubUrl(getterOptions),
12+
content: {
13+
readmeUrl: getReadmeUrl(getterOptions),
14+
},
15+
sandbox: {
16+
component: dynamic(() => import('./PopoverComponent').then((mod) => mod.PopoverComponent)),
17+
props: {
18+
hasArrow: {
19+
type: 'switch',
20+
defaultValue: false,
21+
},
22+
disabled: {
23+
type: 'switch',
24+
defaultValue: false,
25+
},
26+
trigger: {
27+
type: 'select',
28+
values: mappingOptions(['click', 'hover']),
29+
defaultValue: 'hover',
30+
},
31+
placement: {
32+
type: 'select',
33+
values: mappingOptions([
34+
'bottom-start',
35+
'bottom',
36+
'bottom-end',
37+
'top-start',
38+
'top',
39+
'top-end',
40+
'right-start',
41+
'right',
42+
'right-end',
43+
'left-start',
44+
'left',
45+
'left-end',
46+
]),
47+
defaultValue: 'bottom',
48+
},
49+
},
50+
},
51+
};

src/content/components/uikit/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {overlayConfig} from './Overlay';
2323
import {paginationConfig} from './Pagination';
2424
import {paletteConfig} from './Palette';
2525
import {pinInputConfig} from './PinInput';
26+
import {popoverConfig} from './Popover';
2627
import {popupConfig} from './Popup';
2728
import {portalConfig} from './Portal';
2829
import {progressConfig} from './Progress';
@@ -69,6 +70,7 @@ const uikitComponents: Component[] = [
6970
paginationConfig,
7071
paletteConfig,
7172
pinInputConfig,
73+
popoverConfig,
7274
popupConfig,
7375
portalConfig,
7476
progressConfig,

0 commit comments

Comments
 (0)