Skip to content

Commit 5439ba1

Browse files
authored
feat(Divider): add divider docs (#514)
1 parent 446f3c2 commit 5439ba1

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {Container, Divider, Flex, Label} from '@gravity-ui/uikit';
2+
import type {DividerProps} from '@gravity-ui/uikit';
3+
import React from 'react';
4+
5+
type DividerComponentProps = Pick<DividerProps, 'orientation' | 'align' | 'children'>;
6+
7+
export const DividerComponent = ({orientation, align, children}: DividerComponentProps) => {
8+
const divider = (
9+
<Divider orientation={orientation} align={align}>
10+
{children}
11+
</Divider>
12+
);
13+
14+
return (
15+
<Container>
16+
<Flex gap={3} direction={orientation === 'horizontal' ? 'column' : 'row'}>
17+
<Label>Label</Label>
18+
{divider}
19+
<Label>Label</Label>
20+
{divider}
21+
<Label>Label</Label>
22+
{divider}
23+
<Label>Label</Label>
24+
</Flex>
25+
</Container>
26+
);
27+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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: 'Divider'};
7+
8+
export const dividerConfig = {
9+
id: 'divider',
10+
title: 'Divider',
11+
githubUrl: getGithubUrl(getterOptions),
12+
content: {
13+
readmeUrl: getReadmeUrl(getterOptions),
14+
},
15+
sandbox: {
16+
component: dynamic(() => import('./DividerComponent').then((mod) => mod.DividerComponent)),
17+
props: {
18+
orientation: {
19+
type: 'select',
20+
values: mappingOptions(['horizontal', 'vertical']),
21+
defaultValue: 'horizontal',
22+
},
23+
align: {
24+
type: 'select',
25+
values: mappingOptions(['start', 'center', 'end']),
26+
defaultValue: 'start',
27+
},
28+
children: {
29+
type: 'input',
30+
},
31+
},
32+
},
33+
};

src/content/components/uikit/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {buttonConfig} from './Button';
1313
import {cardConfig} from './Card';
1414
import {checkboxConfig} from './Checkbox';
1515
import {disclosureConfig} from './Disclosure';
16+
import {dividerConfig} from './Divider';
1617
import {dropdownMenuConfig} from './DropdownMenu';
1718
import {helpMarkConfig} from './HelpMark';
1819
import {hotkeyConfig} from './Hotkey';
@@ -64,6 +65,7 @@ const uikitComponents: Component[] = [
6465
cardConfig,
6566
checkboxConfig,
6667
disclosureConfig,
68+
dividerConfig,
6769
dropdownMenuConfig,
6870
iconConfig,
6971
labelConfig,

0 commit comments

Comments
 (0)