Skip to content

Commit

Permalink
feat(coachmark): update stories
Browse files Browse the repository at this point in the history
  • Loading branch information
jenndiaz committed Aug 23, 2023
1 parent da46449 commit 111401b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 33 deletions.
3 changes: 2 additions & 1 deletion components/actionmenu/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const Template = ({
items = [],
label,
iconName,
size = "m",
isOpen = true,
...globals
}) => {
Expand All @@ -23,7 +24,7 @@ export const Template = ({

return [
ActionButton({
size: "m",
size,
label,
iconName,
isQuiet: false,
Expand Down
34 changes: 9 additions & 25 deletions components/coachmark/stories/coachmark.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Import the component markup template
import { Template } from "./template";

import { default as ActionButton } from "@spectrum-css/actionbutton/stories/actionbutton.stories.js";
import { default as Menu } from "@spectrum-css/menu/stories/menu.stories.js";

export default {
title: "Components/Coach mark",
description:
Expand Down Expand Up @@ -34,26 +37,19 @@ export default {
},
control: "boolean",
},
isMobile: {
name: "Mobile Variant",
type: { name: "boolean" },
table: {
type: { summary: "boolean" },
category: "Component",
},
control: "boolean",
},
},
args: {
rootClass: "spectrum-CoachMark",
hasActionMenu: true,
hasPagination: true,
hasImage: false,
isMobile: false,
},
parameters: {
actions: {
handles: [],
handles: [
...ActionButton.parameters.actions.handles,
...Menu.parameters.actions.handles,
],
},
status: {
type: process.env.MIGRATED_PACKAGES.includes("coachmark")
Expand All @@ -66,19 +62,7 @@ export default {
export const Default = Template.bind({});
Default.args = {};

export const DefaultWithImage = Template.bind({});
DefaultWithImage.args = {
export const WithMedia = Template.bind({});
WithMedia.args = {
hasImage: true,
};

export const Mobile = Template.bind({});
Mobile.args = {
isMobile: true,
};

export const MobileWithImage = Template.bind({});
MobileWithImage.args = {
isMobile: true,
hasImage: true,
};

20 changes: 13 additions & 7 deletions components/coachmark/stories/template.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { html } from "lit";
import { classMap } from "lit/directives/class-map.js";
import { ifDefined } from 'lit/directives/if-defined.js';
import { useArgs } from "@storybook/client-api";

import { Template as ButtonGroup } from "@spectrum-css/buttongroup/stories/template.js";
import { Template as ActionButton } from "@spectrum-css/actionbutton/stories/template.js";
Expand All @@ -18,14 +18,15 @@ export const Template = ({
hasActionMenu = false,
hasPagination,
hasImage,
isMobile,
isOpen = true,
...globals
}) => {
const [, updateArgs] = useArgs();

return html`
<div cdiv
<div
class=${classMap({
[rootClass]: true,
[`${rootClass}--mobile`]: isMobile,
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
})}
>
Expand All @@ -44,7 +45,12 @@ export const Template = ({
<div class="spectrum-CoachMark-title">Try playing with a pixel brush</div>
<div class="spectrum-CoachMark-action-menu">
${hasActionMenu ? ActionMenu({
isOpen: false,
onclick: function () {
updateArgs({ isOpen: !isOpen });
},
isOpen,
iconName: 'More',
size: globals.scale === "large" ? "s" : "m",
items: [
{
label: "Skip tour",
Expand All @@ -62,8 +68,8 @@ export const Template = ({
<div class="${rootClass}-footer">
${hasPagination ? html`<div class="spectrum-CoachMark-step"><bdo dir="ltr">2 of 8</bdo></div>` : ''}
${ButtonGroup({
size: isMobile ? 's' : 'm',
items: isMobile ?
size: globals.scale === "large" ? "s" : "m",
items: globals.scale === "large" ?
[
{
variant: "secondary",
Expand Down

0 comments on commit 111401b

Please sign in to comment.