mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
38 lines
912 B
TypeScript
38 lines
912 B
TypeScript
|
|
import React from 'react';
|
||
|
|
import { action } from '@storybook/addon-actions';
|
||
|
|
|
||
|
|
import { WeekStartPicker } from '@grafana/ui';
|
||
|
|
import { UseState } from '../../utils/storybook/UseState';
|
||
|
|
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
||
|
|
|
||
|
|
export default {
|
||
|
|
title: 'Pickers and Editors/TimePickers/WeekStartPicker',
|
||
|
|
component: WeekStartPicker,
|
||
|
|
decorators: [withCenteredStory],
|
||
|
|
};
|
||
|
|
|
||
|
|
export const basic = () => {
|
||
|
|
return (
|
||
|
|
<UseState
|
||
|
|
initialState={{
|
||
|
|
value: '',
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
{(value, updateValue) => {
|
||
|
|
return (
|
||
|
|
<WeekStartPicker
|
||
|
|
value={value.value}
|
||
|
|
onChange={(newValue: string) => {
|
||
|
|
if (!newValue) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
action('on selected')(newValue);
|
||
|
|
updateValue({ value: newValue });
|
||
|
|
}}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}}
|
||
|
|
</UseState>
|
||
|
|
);
|
||
|
|
};
|