2019-10-02 08:07:39 +00:00
|
|
|
import React from "react";
|
2021-03-03 11:57:14 +00:00
|
|
|
import DatePicker from "./";
|
2019-09-02 06:45:45 +00:00
|
|
|
|
2021-03-07 11:57:26 +00:00
|
|
|
const locales = [
|
|
|
|
"az",
|
|
|
|
"zh-cn",
|
|
|
|
"cs",
|
|
|
|
"nl",
|
|
|
|
"en-gb",
|
|
|
|
"en",
|
|
|
|
"fi",
|
|
|
|
"fr",
|
|
|
|
"de",
|
|
|
|
"de-ch",
|
|
|
|
"el",
|
|
|
|
"it",
|
|
|
|
"ja",
|
|
|
|
"ko",
|
|
|
|
"lv",
|
|
|
|
"pl",
|
|
|
|
"pt",
|
|
|
|
"pt-br",
|
|
|
|
"ru",
|
|
|
|
"sk",
|
|
|
|
"sl",
|
|
|
|
"es",
|
|
|
|
"tr",
|
|
|
|
"uk",
|
|
|
|
"vi",
|
|
|
|
];
|
|
|
|
|
2021-03-03 11:57:14 +00:00
|
|
|
export default {
|
|
|
|
title: "Components/DatePicker",
|
|
|
|
component: DatePicker,
|
2021-03-07 11:57:26 +00:00
|
|
|
|
2021-03-03 11:57:14 +00:00
|
|
|
argTypes: {
|
2021-03-07 11:57:26 +00:00
|
|
|
themeColor: { control: "color" },
|
|
|
|
selectedDate: { control: "date" },
|
|
|
|
openToDate: { control: "date" },
|
|
|
|
minDate: { control: "date" },
|
|
|
|
maxDate: { control: "date" },
|
|
|
|
onChange: { action: "onChange" },
|
|
|
|
locale: { control: { type: "select", options: locales } },
|
2021-03-03 11:57:14 +00:00
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
description: {
|
|
|
|
component: "Base DatePicker component",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2019-09-02 11:29:56 +00:00
|
|
|
|
2021-03-03 11:57:14 +00:00
|
|
|
const Template = (args) => {
|
2021-03-07 11:57:26 +00:00
|
|
|
console.log(args.locale);
|
2021-03-03 11:57:14 +00:00
|
|
|
return (
|
2021-03-07 11:57:26 +00:00
|
|
|
<div style={{ height: "380px" }}>
|
|
|
|
<DatePicker
|
|
|
|
{...args}
|
|
|
|
onChange={(date) => {
|
|
|
|
args.onChange(date);
|
|
|
|
}}
|
|
|
|
selectedDate={new Date(args.selectedDate)}
|
|
|
|
minDate={new Date(args.minDate)}
|
|
|
|
maxDate={new Date(args.maxDate)}
|
|
|
|
openToDate={new Date(args.openToDate)}
|
|
|
|
/>
|
|
|
|
</div>
|
2021-03-03 11:57:14 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Default = Template.bind({});
|
|
|
|
Default.args = {
|
|
|
|
isOpen: true,
|
|
|
|
calendarHeaderContent: "Select Date",
|
|
|
|
themeColor: "#ED7309",
|
|
|
|
minDate: new Date("1970/01/01"),
|
|
|
|
selectedDate: new Date(),
|
|
|
|
maxDate: new Date(new Date().getFullYear() + 1 + "/01/01"),
|
|
|
|
openToDate: new Date(),
|
|
|
|
calendarSize: "base",
|
2021-03-07 11:57:26 +00:00
|
|
|
locale: "en",
|
2021-03-03 11:57:14 +00:00
|
|
|
};
|