Skip to content

Commit 1850227

Browse files
committed
chore(contextual-help): update template args + story
1 parent 86d392e commit 1850227

File tree

4 files changed

+51
-15
lines changed

4 files changed

+51
-15
lines changed

.changeset/legal-lands-warn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@spectrum-css/contextualhelp": major
3+
---
4+
5+
#### S2 migration for contextual help

components/contextualhelp/stories/contextualhelp.stories.js

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ export default {
3131
iconName: {
3232
name: "Icon",
3333
type: { name: "string", required: true },
34-
defaultValue: "Info",
34+
defaultValue: "InfoCircle",
3535
table: {
3636
type: { summary: "string" },
3737
category: "Component",
3838
defaultValue: { summary: "Info" },
3939
},
40-
options: ["Info", "Help"],
40+
options: ["InfoCircle", "HelpCircle"],
4141
control: "select",
4242
},
4343
iconSet: { table: { disable: true } },
@@ -76,13 +76,43 @@ export default {
7676
],
7777
control: "select",
7878
},
79-
link: { table: { disable: true } },
79+
link: {
80+
name: "Display link",
81+
type: { name: "boolean", required: false },
82+
defaultValue: false,
83+
table: {
84+
summary: "boolean",
85+
category: "Component",
86+
defaultValue: { summary: false }
87+
}
88+
},
89+
linkText: {
90+
name: "Link text",
91+
type: { name: "string", required: true },
92+
table: {
93+
type: { summary: "string" },
94+
category: "Content",
95+
},
96+
if: { arg: "link", truthy: true },
97+
},
98+
linkTarget: {
99+
name: "Link target",
100+
type: { name: "string", required: true },
101+
table: {
102+
type: { summary: "string" },
103+
category: "Content",
104+
},
105+
if: { arg: "link", truthy: true },
106+
},
80107
},
81108
args: {
82109
rootClass: "spectrum-ContextualHelp",
83-
iconName: "Info",
110+
iconName: "InfoCircle",
84111
iconSet: "workflow",
85112
popoverPlacement: "bottom-start",
113+
link: false,
114+
linkText: "Link text",
115+
linkTarget: "#",
86116
title: "Permission required",
87117
body: "Your admin must grant you permission before you can create a new document. Please contact your admin for more information.",
88118
customStyles: { "inline-size": "275px" },
@@ -180,7 +210,7 @@ TopPopover.storyName = "Default - top popover";
180210
export const HelpDefault = Template.bind({});
181211
HelpDefault.tags = ["!dev"];
182212
HelpDefault.args = {
183-
iconName: "Help",
213+
iconName: "HelpCircle",
184214
title: "Need help?",
185215
};
186216
HelpDefault.parameters = {
@@ -195,7 +225,7 @@ HelpWithLink.args = {
195225
text: "Learn about permissions",
196226
url: "#",
197227
},
198-
iconName: "Help",
228+
iconName: "HelpCircle",
199229
title: "Need help?",
200230
body: "Reach out to your admin for help regarding the document you are trying to create.",
201231
};
@@ -214,7 +244,7 @@ HelpTopPopover.args = {
214244
},
215245
title: "Need help?",
216246
body: "Reach out to your admin for help regarding the document you are trying to create.",
217-
iconName: "Help",
247+
iconName: "HelpCircle",
218248
};
219249
HelpTopPopover.parameters = {
220250
chromatic: { disableSnapshot: true },
@@ -236,7 +266,7 @@ HelpMaxWidthPopover.args = {
236266
},
237267
title: "Need help?",
238268
body: "Reach out to your admin for help regarding the document you are trying to create.",
239-
iconName: "Help",
269+
iconName: "HelpCircle",
240270
};
241271
HelpMaxWidthPopover.parameters = {
242272
chromatic: { disableSnapshot: true },

components/contextualhelp/stories/contextualhelp.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ export const ContextualHelpGroup = Variants({
2525
"inline-size": "275px",
2626
"margin-bottom": "200px",
2727
},
28-
link: {
29-
text: "Learn about permissions",
30-
url: "#",
31-
},
28+
link: true,
29+
linkText: "Link text",
30+
linkTarget: "#",
3231
},
3332
{
3433
testHeading: "Help",
35-
iconName: "Help",
34+
iconName: "HelpCircle",
3635
customStyles: {
3736
"inline-size": "275px",
3837
"margin-bottom": "170px",

components/contextualhelp/stories/template.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export const Template = ({
1717
title,
1818
body,
1919
link,
20+
linkText,
21+
linkTarget,
2022
popoverPlacement,
2123
customStyles = {},
2224
customClasses = [],
@@ -44,8 +46,8 @@ export const Template = ({
4446
body ? html`<p class="${rootClass}-body">${body}</p>` : "",
4547
link
4648
? Link({
47-
text: link.text,
48-
url: link.url,
49+
text: linkText,
50+
url: linkTarget,
4951
customClasses: [`${rootClass}-link`],
5052
})
5153
: nothing,

0 commit comments

Comments
 (0)