Skip to content

Commit

Permalink
feat: add Select documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
korvin89 committed Dec 8, 2023
1 parent 4d6cc0c commit 4e06ca4
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 29 deletions.
142 changes: 114 additions & 28 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 @@ -8,7 +8,7 @@
"@gravity-ui/components": "2.1.0",
"@gravity-ui/icons": "^2.8.1",
"@gravity-ui/page-constructor": "^4.41.0",
"@gravity-ui/uikit": "5.12.1",
"@gravity-ui/uikit": "5.24.0",
"@mdx-js/mdx": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@testing-library/jest-dom": "^5.16.5",
Expand Down
13 changes: 13 additions & 0 deletions src/content/components/uikit/Select/SelectComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {Select, SelectProps} from '@gravity-ui/uikit';
import React from 'react';

export const SelectComponent = (props: SelectProps) => {
return (
<Select {...props}>
<Select.Option value="val_1">Value 1</Select.Option>
<Select.Option value="val_2">Value 2</Select.Option>
<Select.Option value="val_3">Value 3</Select.Option>
<Select.Option value="val_4">Value 4</Select.Option>
</Select>
);
};
69 changes: 69 additions & 0 deletions src/content/components/uikit/Select/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import dynamic from 'next/dynamic';

import {Repos} from '../../../../types/common';
import {Component} from '../../types';
import {getGithubUrl, getReadmeUrl, mappingOptions} from '../../utils';

const getterOptions = {repoName: Repos.Uikit, componentName: 'Select'};

export const selectConfig: Component = {
id: 'select',
title: 'Select',
githubUrl: getGithubUrl(getterOptions),
content: {
readmeUrl: getReadmeUrl(getterOptions),
},
sandbox: {
component: dynamic(() => import('./SelectComponent').then((mod) => mod.SelectComponent)),
props: {
size: {
type: 'radioButton',
values: mappingOptions(['s', 'm', 'l', 'xl']),
defaultValue: 'm',
},
pin: {
type: 'select',
values: mappingOptions([
'round-round',
'brick-brick',
'clear-clear',
'round-brick',
'brick-round',
'round-clear',
'clear-round',
'brick-clear',
'clear-brick',
'circle-circle',
'circle-brick',
'brick-circle',
'circle-clear',
'clear-circle',
]),
defaultValue: 'round-round',
},
placeholder: {
type: 'input',
defaultValue: '',
},
label: {
type: 'input',
},
multiple: {
type: 'switch',
defaultValue: false,
},
filterable: {
type: 'switch',
defaultValue: false,
},
disabled: {
type: 'switch',
defaultValue: false,
},
hasClear: {
type: 'switch',
defaultValue: false,
},
},
},
};
2 changes: 2 additions & 0 deletions src/content/components/uikit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {progressConfig} from './Progress';
import {radioConfig} from './Radio';
import {radioButtonConfig} from './RadioButton';
import {radioGroupConfig} from './RadioGroup';
import {selectConfig} from './Select';
import {skeletonConfig} from './Skeleton';
import {spinConfig} from './Spin';
import {switchConfig} from './Switch';
Expand Down Expand Up @@ -61,6 +62,7 @@ const uikitComponents: Component[] = [
radioConfig,
radioButtonConfig,
radioGroupConfig,
selectConfig,
skeletonConfig,
spinConfig,
switchConfig,
Expand Down

0 comments on commit 4e06ca4

Please sign in to comment.