Skip to content

Commit a428721

Browse files
feat(Components): add Accordion component (#442)
* feat(Components): add Accordion component * chore: update uikit
1 parent bc8a83b commit a428721

File tree

5 files changed

+74
-5
lines changed

5 files changed

+74
-5
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@gravity-ui/markdown-editor": "^15.1.0",
1515
"@gravity-ui/navigation": "^3.6.4",
1616
"@gravity-ui/page-constructor": "^6.0.0-beta.6",
17-
"@gravity-ui/uikit": "^7.21.0",
17+
"@gravity-ui/uikit": "^7.22.0",
1818
"@gravity-ui/uikit-themer": "^1.4.1",
1919
"@mdx-js/mdx": "^2.3.0",
2020
"@mdx-js/react": "^2.3.0",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {Accordion, AccordionProps} from '@gravity-ui/uikit';
2+
3+
type Props = {
4+
size: AccordionProps['size'];
5+
view: AccordionProps['view'];
6+
arrowPosition: AccordionProps['arrowPosition'];
7+
multiple: AccordionProps['multiple'];
8+
};
9+
10+
export function AccordionComponent(props: Props) {
11+
const {arrowPosition, multiple, view, size} = props;
12+
return (
13+
<Accordion multiple={multiple} view={view} size={size} arrowPosition={arrowPosition}>
14+
<Accordion.Item summary={'Accordion summmary 1'}>
15+
Some content for this item
16+
</Accordion.Item>
17+
<Accordion.Item summary={'Accordion summmary 2'}>
18+
Some content for this item
19+
</Accordion.Item>
20+
<Accordion.Item summary={'Accordion summmary 3'}>
21+
Some content for this item
22+
</Accordion.Item>
23+
</Accordion>
24+
);
25+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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: 'Accordion'};
7+
8+
export const accordionConfig = {
9+
id: 'accordion',
10+
title: 'Accordion',
11+
githubUrl: getGithubUrl(getterOptions),
12+
isSupportRTL: true,
13+
content: {
14+
readmeUrl: getReadmeUrl(getterOptions),
15+
},
16+
sandbox: {
17+
component: dynamic(() =>
18+
import('./AccordionComponent').then((mod) => mod.AccordionComponent),
19+
),
20+
props: {
21+
view: {
22+
type: 'select',
23+
values: mappingOptions(['solid', 'top-bottom']),
24+
defaultValue: 'solid',
25+
},
26+
size: {
27+
type: 'radioButton',
28+
values: mappingOptions(['m', 'l', 'xl']),
29+
defaultValue: 'm',
30+
},
31+
arrowPosition: {
32+
type: 'radioButton',
33+
values: mappingOptions(['start', 'end']),
34+
defaultValue: 'end',
35+
},
36+
multiple: {
37+
type: 'switch',
38+
defaultValue: false,
39+
},
40+
},
41+
},
42+
};

src/content/components/uikit/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {sortBy} from 'lodash';
33
import {getLibConfigById} from '../../../utils';
44
import {Component, Lib} from '../types';
55

6+
import {accordionConfig} from './Accordion';
67
import {alertConfig} from './Alert';
78
import {arrowToggleConfig} from './ArrowToggle';
89
import {avatarConfig} from './Avatar';
@@ -48,6 +49,7 @@ import {userLabelConfig} from './UserLabel';
4849
const config = getLibConfigById('uikit');
4950

5051
const uikitComponents: Component[] = [
52+
accordionConfig,
5153
alertConfig,
5254
arrowToggleConfig,
5355
avatarConfig,

0 commit comments

Comments
 (0)