Skip to content

Commit 71574dc

Browse files
marissahuysentruytcastastrophe
authored andcommitted
chore(calendar,card,coachmark): remove MDX files (#3443)
* chore(card): remove default args from test cases * docs(card): remove MDX file - adds some missing documentation regarding stories - reorganizes some information to sit with appropriate story/variant - migrates documentation from MDX file to the stories file instead * docs(coachmark): remove MDX file - adds some missing documentation regarding stories - reorganizes some information to sit with appropriate story/variant - migrates documentation from MDX file to the stories file instead * chore(coachmark): adds extra chromatic coverage * docs(calendar): remove MDX file - migrates documentation from MDX file to the stories file instead * docs(calendar): clarifies days of the week control name * docs(card): clarify quiet control requirements * chore(coachmark): remove html wrapper in favor of content array * chore(card): fix isQuiet controls and usage in template * docs(asset,card): isCardAssetOverride renamed to isImageFill
1 parent 16f4235 commit 71574dc

File tree

12 files changed

+187
-268
lines changed

12 files changed

+187
-268
lines changed

components/asset/stories/template.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const Template = ({
1616
id = getRandomId("asset"),
1717
customClasses = [],
1818
customStyles = {},
19-
isCardAssetOverride = false,
19+
isImageFill = false,
2020
} = {}) => {
2121
let visual;
2222
if (preset === "file") {
@@ -38,8 +38,8 @@ export const Template = ({
3838
class="${rootClass}-image"
3939
src=${ifDefined(image)}
4040
style=${styleMap({
41-
"max-inline-size": !isCardAssetOverride ? "75%" : undefined,
42-
"max-block-size": !isCardAssetOverride ? "75%" : undefined,
41+
"max-inline-size": !isImageFill ? "75%" : undefined,
42+
"max-block-size": !isImageFill ? "75%" : undefined,
4343
})}
4444
/>`;
4545
}

components/calendar/stories/calendar.mdx

Lines changed: 0 additions & 60 deletions
This file was deleted.

components/calendar/stories/calendar.stories.js

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const months = [...Array(12).keys()].map((key) =>
1111
);
1212

1313
/**
14-
* Calendars display a grid of days in one or more months and allow users to select a single date.
14+
* Calendars display a grid of days in one or more months and allow users to select a single date or a range of dates.
1515
*/
1616
export default {
1717
title: "Calendar",
@@ -27,6 +27,9 @@ export default {
2727
options: months,
2828
control: "select",
2929
},
30+
// The date selection controls don't update the story, so they are removed from the table.
31+
// TODO: We may have to refactor some of the template to create a working controls for the
32+
// selectable dates.
3033
selectedDay: {
3134
name: "Selected date or range start (date)",
3235
description:
@@ -35,19 +38,33 @@ export default {
3538
table: {
3639
type: { summary: "datetime" },
3740
category: "Content",
41+
disable: true,
3842
},
3943
control: "date",
4044
if: { arg: "isDisabled", truthy: false },
4145
},
46+
isRangeSelection : {
47+
name: "Range selection",
48+
description: "Allow users to select a range of dates.",
49+
type: { name: "boolean" },
50+
table: {
51+
type: { summary: "boolean" },
52+
category: "Content",
53+
disable: true,
54+
},
55+
control: "boolean",
56+
},
4257
lastDay: {
4358
name: "Range end (date)",
4459
description: "Defines the end of a date range.",
4560
type: { name: "number" },
4661
table: {
4762
type: { summary: "datetime" },
4863
category: "Content",
64+
disable: true,
4965
},
5066
control: "date",
67+
if: { arg: "isRangeSelection", truthy: true}
5168
},
5269
year: {
5370
name: "Year",
@@ -69,7 +86,8 @@ export default {
6986
control: "boolean",
7087
},
7188
useDOWAbbrev: {
72-
name: "Use 3 letter abbreviation for day of week",
89+
name: "Use abbreviated weekdays",
90+
description: "Uses a 3 letter abbreviation for day of week.",
7391
type: { name: "boolean" },
7492
table: {
7593
type: { summary: "boolean" },
@@ -89,6 +107,7 @@ export default {
89107
isFocused: false,
90108
useDOWAbbrev: false,
91109
buttonSize: ActionButtonStories.args.size,
110+
isRangeSelection: false,
92111
},
93112
parameters: {
94113
actions: {
@@ -99,45 +118,52 @@ export default {
99118
packageJson,
100119
metadata,
101120
},
102-
tags: ["!autodocs"],
103121
};
104122

105123
export const Default = CalendarGroup.bind({});
106124
Default.args = {
107125
month: months[6],
108-
selectedDay: new Date(2023, 6, 3),
109-
year: 2023,
126+
selectedDay: new Date(2025, 6, 3),
127+
year: 2025,
110128
};
111129

112130
// ********* DOCS ONLY ********* //
113131
export const AbbreviatedWeekdays = Template.bind({});
114132
AbbreviatedWeekdays.args = {
133+
...Default.args,
115134
useDOWAbbrev: true,
116135
};
117136
AbbreviatedWeekdays.tags = ["!dev"];
118137
AbbreviatedWeekdays.parameters = {
119138
chromatic: { disableSnapshot: true },
120139
};
140+
AbbreviatedWeekdays.storyName = "Abbreviated weekdays";
141+
142+
/**
143+
* For calendars with a selectable range:
121144
145+
- The `.is-range-start` and `.is-range-selection` classes go on the first day in the selection.
146+
- The `.is-range-end` and `.is-range-selection` classes go on the last day of the selection.
147+
- The `.is-range-selection` class goes on all days in the middle of the selection.
148+
*/
122149
export const RangeSelection = Template.bind({});
123150
RangeSelection.args = {
151+
isRangeSelection: true,
124152
month: months[6],
125-
selectedDay: new Date(2023, 6, 3),
126-
year: 2023,
127-
lastDay: new Date(2023, 6, 7),
128-
useDOWAbbrev: true,
153+
selectedDay: new Date(2025, 6, 3),
154+
year: 2025,
155+
lastDay: new Date(2025, 6, 7),
129156
isPadded: true,
130157
};
131-
RangeSelection.tags = ["!dev"];
132158
RangeSelection.parameters = {
133159
chromatic: { disableSnapshot: true },
134160
};
161+
RangeSelection.storyName = "Range selection";
135162

136163
export const Focused = Template.bind({});
137164
Focused.args = {
138-
month: undefined,
165+
...Default.args,
139166
selectedDay: undefined,
140-
year: undefined,
141167
isFocused: true,
142168
};
143169
Focused.tags = ["!dev"];
@@ -148,6 +174,7 @@ Focused.parameters = {
148174
export const Disabled = Template.bind({});
149175
Disabled.tags = ["!dev"];
150176
Disabled.args = {
177+
...Default.args,
151178
isDisabled: true
152179
};
153180
Disabled.parameters = {

components/calendar/stories/template.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const Template = ({
139139
if (firstDOWInMonth > DOW.length - orphanedDays) {
140140
weeksInMonth++;
141141
}
142-
if (displayedMonth === 1 && firstDOWInMonth > 0) { // accounts for Feburary
142+
if (displayedMonth === 1 && firstDOWInMonth > 0) { // accounts for February
143143
weeksInMonth++;
144144
}
145145

@@ -368,8 +368,6 @@ export const Template = ({
368368
"is-range-start": thisDay.isRangeStart,
369369
"is-range-end": thisDay.isRangeEnd,
370370
"is-selected": thisDay.isSelected,
371-
// "is-selection-start": thisDay.isRangeStart,
372-
// "is-selection-end": thisDay.isRangeEnd,
373371
"is-disabled": isDisabled,
374372
"is-focused": (isFocused && thisDay.isFocused) || thisDay.isSelected,
375373
})}

components/card/stories/card.mdx

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)