Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(DatePicker): add description and sandbox for DatePicker #170

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -6,7 +6,7 @@
"dependencies": {
"@doc-tools/transform": "^3.11.0",
"@gravity-ui/components": "2.1.0",
"@gravity-ui/date-components": "^1.4.0",
"@gravity-ui/date-components": "^1.5.0",
"@gravity-ui/icons": "^2.8.1",
"@gravity-ui/page-constructor": "^4.41.0",
"@gravity-ui/uikit": "5.24.0",
Expand Down
6 changes: 6 additions & 0 deletions src/content/components/date-components/DateField/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ export const dateFieldConfig: Component = {
maxValue: {
type: 'input',
},
leftContent: {
type: 'input',
},
rightContent: {
type: 'input',
},
},
},
};
81 changes: 80 additions & 1 deletion src/content/components/date-components/DatePicker/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,86 @@
import dynamic from 'next/dynamic';
import {Repos} from 'src/types/common';

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

const getterOptions = {repoName: Repos.DateComponents, componentName: 'DatePicker'};

export const datePickerConfig: Component = {
id: 'date-picker',
title: 'Date Picker',
isComingSoon: true,
githubUrl: getGithubUrl(getterOptions),
content: {
readmeUrl: getReadmeUrl(getterOptions),
},
sandbox: {
component: dynamic(() =>
import('../examples/components/index').then((mod) => mod.DatePickerSandboxExample),
),
props: {
view: {
type: 'radioButton',
values: mappingOptions(['normal', 'clear']),
defaultValue: 'normal',
},
size: {
type: 'radioButton',
values: mappingOptions(['s', 'm', 'l', 'xl']),
defaultValue: 'm',
},
placeholder: {
type: 'input',
defaultValue: 'Type here...',
},
label: {
type: 'input',
},
validationState: {
type: 'radioButton',
values: mappingOptions(['normal', 'invalid']),
defaultValue: 'normal',
},
errorMessage: {
type: 'input',
defaultValue: 'Input is invalid',
},
disabled: {
type: 'switch',
defaultValue: false,
},
hasClear: {
type: 'switch',
defaultValue: false,
},
readOnly: {
type: 'switch',
defaultValue: false,
},
format: {
type: 'input',
defaultValue: 'MM/DD/YYYY',
},
pin: {
type: 'select',
values: mappingOptions([
'round-round',
'brick-brick',
'clear-clear',
'round-brick',
'brick-round',
'round-clear',
'clear-round',
'brick-clear',
'clear-brick',
]),
defaultValue: 'round-round',
},
minValue: {
type: 'input',
},
maxValue: {
type: 'input',
},
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {DatePicker, DatePickerProps} from '@gravity-ui/date-components';
import {DateTimeInput, dateTimeParse} from '@gravity-ui/date-utils';

type DatePickerExampleProps = {
defaultValue?: DateTimeInput;
maxValue?: DateTimeInput;
minValue?: DateTimeInput;
} & Omit<DatePickerProps, 'defaultValue' | 'maxValue' | 'minValue'>;

export const DatePickerExample = ({
defaultValue,
maxValue,
minValue,
...restProps
}: DatePickerExampleProps) => {
return (
<DatePicker
{...restProps}
defaultValue={dateTimeParse(defaultValue)}
maxValue={dateTimeParse(maxValue)}
minValue={dateTimeParse(minValue)}
/>
);
};

export const DatePickerSandboxExample = (props: DatePickerExampleProps) => (
<DatePickerExample {...props} style={{alignSelf: 'flex-start'}} />
);
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './CalendarExample';
export * from './RangeCalendarExample';
export * from './DateFieldExample';
export * from './DatePickerExample';
Loading