bananas-commerce-admin
Version:
What's this, an admin for apes?
95 lines • 2.62 kB
JavaScript
import React from "react";
import { DateTime } from "luxon";
import CardContent from "./CardContent";
import { CardFieldDate } from "./CardFieldDate";
import CardHeader from "./CardHeader";
import CardRow from "./CardRow";
import Card from "./index";
const meta = {
component: CardFieldDate,
decorators: [
(Story) => (React.createElement(Card, { defaultEditing: true, isEditable: true },
React.createElement(CardHeader, { title: "CardFieldDate Demo" }),
React.createElement(CardContent, null,
React.createElement(CardRow, null,
React.createElement(Story, null))))),
],
};
export default meta;
export const Default = {
args: {
label: "Date",
formName: "date",
value: DateTime.now(),
},
};
export const WithCustomValue = {
args: {
label: "Birth Date",
formName: "birthDate",
value: DateTime.fromISO("1990-01-15"),
},
};
export const WithStringValue = {
args: {
label: "Event Date",
formName: "eventDate",
value: "2024-12-31",
},
};
export const Empty = {
args: {
label: "Optional Date",
formName: "optionalDate",
value: undefined,
},
};
export const Disabled = {
args: {
label: "Disabled Date",
formName: "disabledDate",
value: DateTime.now(),
isDisabled: true,
},
};
export const WithHelperText = {
args: {
label: "Appointment Date",
formName: "appointmentDate",
value: DateTime.now(),
helperText: "Please select your preferred appointment date",
},
};
export const WithLocaleGB = {
args: {
label: "Date (en-GB locale)",
formName: "dateGB",
value: DateTime.now(),
adapterLocale: "en-GB",
helperText: "Week starts on Monday",
},
};
export const WithLocaleUS = {
args: {
label: "Date (en-US locale)",
formName: "dateUS",
value: DateTime.now(),
adapterLocale: "en-US",
helperText: "Week starts on Sunday",
},
};
export const ReadOnlyMode = {
args: {
label: "Created At",
formName: "createdAt",
value: DateTime.fromISO("2023-06-15"),
},
decorators: [
(Story) => (React.createElement(Card, null,
React.createElement(CardHeader, { title: "Read-Only CardFieldDate" }),
React.createElement(CardContent, null,
React.createElement(CardRow, null,
React.createElement(Story, null))))),
],
};
//# sourceMappingURL=CardFieldDate.stories.js.map