Skip to content

chore(calendar,card,coachmark): remove MDX files #3443

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

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
6 changes: 3 additions & 3 deletions components/asset/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Template = ({
id = getRandomId("asset"),
customClasses = [],
customStyles = {},
isCardAssetOverride = false,
isImageFill = false,
} = {}) => {
let visual;
if (preset === "file") {
Expand All @@ -38,8 +38,8 @@ export const Template = ({
class="${rootClass}-image"
src=${ifDefined(image)}
style=${styleMap({
"max-inline-size": !isCardAssetOverride ? "75%" : undefined,
"max-block-size": !isCardAssetOverride ? "75%" : undefined,
"max-inline-size": !isImageFill ? "75%" : undefined,
"max-block-size": !isImageFill ? "75%" : undefined,
})}
/>`;
}
Expand Down
60 changes: 0 additions & 60 deletions components/calendar/stories/calendar.mdx

This file was deleted.

51 changes: 39 additions & 12 deletions components/calendar/stories/calendar.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const months = [...Array(12).keys()].map((key) =>
);

/**
* Calendars display a grid of days in one or more months and allow users to select a single date.
* Calendars display a grid of days in one or more months and allow users to select a single date or a range of dates.
*/
export default {
title: "Calendar",
Expand All @@ -27,6 +27,9 @@ export default {
options: months,
control: "select",
},
// The date selection controls don't update the story, so they are removed from the table.
// TODO: We may have to refactor some of the template to create a working controls for the
// selectable dates.
selectedDay: {
name: "Selected date or range start (date)",
description:
Expand All @@ -35,19 +38,33 @@ export default {
table: {
type: { summary: "datetime" },
category: "Content",
disable: true,
},
control: "date",
if: { arg: "isDisabled", truthy: false },
},
isRangeSelection : {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could understand if we wanted to remove this for now. It definitely feels like we could get this to work in the template, but I didn't want to sink too much time dedicated to that, in this PR.

name: "Range selection",
description: "Allow users to select a range of dates.",
type: { name: "boolean" },
table: {
type: { summary: "boolean" },
category: "Content",
disable: true,
},
control: "boolean",
},
lastDay: {
name: "Range end (date)",
description: "Defines the end of a date range.",
type: { name: "number" },
table: {
type: { summary: "datetime" },
category: "Content",
disable: true,
},
control: "date",
if: { arg: "isRangeSelection", truthy: true}
},
year: {
name: "Year",
Expand All @@ -69,7 +86,8 @@ export default {
control: "boolean",
},
useDOWAbbrev: {
name: "Use 3 letter abbreviation for day of week",
name: "Use abbreviated weekdays",
description: "Uses a 3 letter abbreviation for day of week.",
type: { name: "boolean" },
table: {
type: { summary: "boolean" },
Expand All @@ -89,6 +107,7 @@ export default {
isFocused: false,
useDOWAbbrev: false,
buttonSize: ActionButtonStories.args.size,
isRangeSelection: false,
},
parameters: {
actions: {
Expand All @@ -99,45 +118,52 @@ export default {
packageJson,
metadata,
},
tags: ["!autodocs"],
};

export const Default = CalendarGroup.bind({});
Default.args = {
month: months[6],
selectedDay: new Date(2023, 6, 3),
year: 2023,
selectedDay: new Date(2025, 6, 3),
year: 2025,
};

// ********* DOCS ONLY ********* //
export const AbbreviatedWeekdays = Template.bind({});
AbbreviatedWeekdays.args = {
...Default.args,
useDOWAbbrev: true,
};
AbbreviatedWeekdays.tags = ["!dev"];
AbbreviatedWeekdays.parameters = {
chromatic: { disableSnapshot: true },
};
AbbreviatedWeekdays.storyName = "Abbreviated weekdays";

/**
* For calendars with a selectable range:

- The `.is-range-start` and `.is-range-selection` classes go on the first day in the selection.
- The `.is-range-end` and `.is-range-selection` classes go on the last day of the selection.
- The `.is-range-selection` class goes on all days in the middle of the selection.
*/
export const RangeSelection = Template.bind({});
RangeSelection.args = {
isRangeSelection: true,
month: months[6],
selectedDay: new Date(2023, 6, 3),
year: 2023,
lastDay: new Date(2023, 6, 7),
useDOWAbbrev: true,
selectedDay: new Date(2025, 6, 3),
year: 2025,
lastDay: new Date(2025, 6, 7),
isPadded: true,
};
RangeSelection.tags = ["!dev"];
RangeSelection.parameters = {
chromatic: { disableSnapshot: true },
};
RangeSelection.storyName = "Range selection";

export const Focused = Template.bind({});
Focused.args = {
month: undefined,
...Default.args,
selectedDay: undefined,
year: undefined,
isFocused: true,
};
Focused.tags = ["!dev"];
Expand All @@ -148,6 +174,7 @@ Focused.parameters = {
export const Disabled = Template.bind({});
Disabled.tags = ["!dev"];
Disabled.args = {
...Default.args,
isDisabled: true
};
Disabled.parameters = {
Expand Down
4 changes: 1 addition & 3 deletions components/calendar/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const Template = ({
if (firstDOWInMonth > DOW.length - orphanedDays) {
weeksInMonth++;
}
if (displayedMonth === 1 && firstDOWInMonth > 0) { // accounts for Feburary
if (displayedMonth === 1 && firstDOWInMonth > 0) { // accounts for February
weeksInMonth++;
}

Expand Down Expand Up @@ -368,8 +368,6 @@ export const Template = ({
"is-range-start": thisDay.isRangeStart,
"is-range-end": thisDay.isRangeEnd,
"is-selected": thisDay.isSelected,
// "is-selection-start": thisDay.isRangeStart,
// "is-selection-end": thisDay.isRangeEnd,
"is-disabled": isDisabled,
"is-focused": (isFocused && thisDay.isFocused) || thisDay.isSelected,
})}
Expand Down
87 changes: 0 additions & 87 deletions components/card/stories/card.mdx

This file was deleted.

Loading