Skip to content

Commit

Permalink
chore(coachmark): clean up + add stories
Browse files Browse the repository at this point in the history
  • Loading branch information
cdransf committed Jan 24, 2025
1 parent 34e3a02 commit e069c49
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 12 deletions.
53 changes: 44 additions & 9 deletions components/coachmark/stories/coachmark.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import metadata from "../dist/metadata.json";
import packageJson from "../package.json";
import { CoachMarkGroup } from "./coachmark.test.js";
import {
Template,
CoachmarkMenuStatesTemplate,
CoachmarkMediaStatesTemplate,
CoachmarkShortcutStatesTemplate,
Expand Down Expand Up @@ -105,7 +106,7 @@ export default {
metadata,
docs: {
story: {
height: "450px",
height: "525px",
},
},
},
Expand All @@ -117,17 +118,43 @@ Default.tags = ["!autodocs"];
Default.parameters = {};

/**
* Coach marks are temporary messages that educate users through new or unfamiliar product experiences. They can be chained into a sequence to form a tour. They may contain images or media that relate to their content, such as demonstrations of gestures, the UI being used, or illustrations.
* Coach marks are temporary messages that educate users through new or unfamiliar product experiences. They can be chained into a sequence to form a tour. They may contain images or media that relate to their content, such as demonstrations of gestures, the UI being used, or illustrations. All coach marks can have any combination of action menu, media, and keyboard shortcut options.
*/
export const Standard = CoachmarkMenuStatesTemplate.bind({});
export const Standard = Template.bind({});
Standard.storyName = "Default";
Standard.tags = ["!dev"];
Standard.parameters = {
chromatic: {
disableSnapshot: true,
},
docs: {
story: {
height: "475px",
},
},
};
Standard.args = {
image: "example-card-landscape.png",
hasImage: true,
hasActionMenu: false,
imageIsFixedHeight: false,
};

export const StandardNoMedia = Template.bind({});
StandardNoMedia.storyName = "Default, no media";
StandardNoMedia.args = {
hasImage: false,
};
StandardNoMedia.parameters = {
chromatic: {
disableSnapshot: true,
},
docs: {
story: {
height: "250px",
},
},
};
Standard.args = { image: "example-card-landscape.png" };

/** Images and media have a minimum height and can grow with the parent component. Fixed height media is constrained to a 4:3 aspect ratio by applying the spectrum-CoachMark-image-wrapper--fixedHeight class. */
export const MediaStates = CoachmarkMediaStatesTemplate.bind({});
Expand All @@ -139,13 +166,21 @@ MediaStates.parameters = {
chromatic: {
disableSnapshot: true,
},
docs: {
story: {
height: "725px",
},
},
};
MediaStates.storyName = "Media states";

/** The action menu, if enabled, is shown in line with the title. */
export const WithActionMenu = CoachmarkMenuStatesTemplate.bind({});
WithActionMenu.storyName = "With action menu";
WithActionMenu.args = {
hasActionMenu: true,
};
WithActionMenu.parameters = {
chromatic: {
disableSnapshot: true,
},
};

/** Keyboard shortcuts may be shown in place of or below the action menu. */
export const ShortCutStories = CoachmarkShortcutStatesTemplate.bind({});
ShortCutStories.tags = ["!dev"];
Expand Down
6 changes: 3 additions & 3 deletions components/coachmark/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ export const CoachmarkMenuStatesTemplate = (args, context) =>
content: [
Container({
withBorder: false,
heading: "With media, without action menu",
heading: "Media, without action menu",
content: Template({ ...args }, context),
}),
Container({
withBorder: false,
heading: "With action menu, without media",
heading: "Action menu, without media",
content: Template(
{ ...args, hasImage: false, hasActionMenu: true },
{ ...args, hasImage: false, hasActionMenu: true, isOpen: true },
context,
),
}),
Expand Down

0 comments on commit e069c49

Please sign in to comment.