Web:Components:Cron Added context
This commit is contained in:
parent
58e0603cda
commit
9f0266f84e
@ -15,6 +15,9 @@ const globalTypes = {
|
||||
description: "Internationalization locale",
|
||||
toolbar: {
|
||||
icon: "globe",
|
||||
defaultValue: "en",
|
||||
dynamicTitle: true,
|
||||
showName: true,
|
||||
items: [
|
||||
{ value: "ar-SA", title: "عربي (المملكة العربية السعودية)" },
|
||||
{ value: "az", title: "Azərbaycan (Latın, Azərbaycan)" },
|
||||
@ -45,7 +48,6 @@ const globalTypes = {
|
||||
{ value: "vi", title: "Tiếng Việt (Việt Nam)" },
|
||||
{ value: "zh-CN", title: "中文(简体,中国)" },
|
||||
],
|
||||
showName: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -31,12 +31,14 @@ export default meta;
|
||||
export const Default: Story = {
|
||||
args: {},
|
||||
|
||||
render: ({ value: defaultValue }) => {
|
||||
render: ({ value: defaultValue }, context) => {
|
||||
const [input, setInput] = useState(defaultValue);
|
||||
|
||||
const [cron, setCron] = useState(defaultValue);
|
||||
const [error, setError] = useState<Error>();
|
||||
|
||||
const { locale } = context.globals;
|
||||
|
||||
const onError = (error?: Error) => {
|
||||
setError(error);
|
||||
};
|
||||
@ -86,7 +88,10 @@ export const Default: Story = {
|
||||
{date && (
|
||||
<p>
|
||||
<strong>Next synchronization: </strong>{" "}
|
||||
{date.toUTC().setLocale("en-GB").toFormat("DDDD tt")}
|
||||
{date
|
||||
.toUTC()
|
||||
.setLocale(locale ?? "en")
|
||||
.toFormat("DDDD tt")}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user