Skip to content

Commit ad96e36

Browse files
Merge release/2.0.4 into main branch (#964)
* add feature variant to Alert / Callout, un-publish announcement variant (#963)
1 parent baa0ae6 commit ad96e36

File tree

6 files changed

+75
-59
lines changed

6 files changed

+75
-59
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@user-interviews/ui-design-system",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"dependencies": {
55
"react-bootstrap": "^2.5.0",
66
"react-currency-input-field": "^3.6.10",

spec/__snapshots__/Storyshots.test.js.snap

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,18 +1091,18 @@ Array [
10911091
]
10921092
`;
10931093

1094-
exports[`Storyshots Components/Alert Announcement 1`] = `
1094+
exports[`Storyshots Components/Alert Error 1`] = `
10951095
<div
1096-
className="Alert Alert-announcement"
1096+
className="Alert Alert-error"
10971097
style={null}
10981098
>
10991099
<div
11001100
className="Alert__icon"
11011101
>
11021102
<svg
11031103
aria-hidden="true"
1104-
className="svg-inline--fa fa-bullhorn "
1105-
data-icon="bullhorn"
1104+
className="svg-inline--fa fa-exclamation-triangle "
1105+
data-icon="exclamation-triangle"
11061106
data-prefix="fas"
11071107
focusable="false"
11081108
role="img"
@@ -1123,7 +1123,7 @@ exports[`Storyshots Components/Alert Announcement 1`] = `
11231123
transform="translate(0, 0) scale(1.125, 1.125) rotate(0 0 0)"
11241124
>
11251125
<path
1126-
d="M576 240c0-23.63-12.95-44.04-32-55.12V32.01C544 23.26 537.02 0 512 0c-7.12 0-14.19 2.38-19.98 7.02l-85.03 68.03C364.28 109.19 310.66 128 256 128H64c-35.35 0-64 28.65-64 64v96c0 35.35 28.65 64 64 64h33.7c-1.39 10.48-2.18 21.14-2.18 32 0 39.77 9.26 77.35 25.56 110.94 5.19 10.69 16.52 17.06 28.4 17.06h74.28c26.05 0 41.69-29.84 25.9-50.56-16.4-21.52-26.15-48.36-26.15-77.44 0-11.11 1.62-21.79 4.41-32H256c54.66 0 108.28 18.81 150.98 52.95l85.03 68.03a32.023 32.023 0 0 0 19.98 7.02c24.92 0 32-22.78 32-32V295.13C563.05 284.04 576 263.63 576 240zm-96 141.42l-33.05-26.44C392.95 311.78 325.12 288 256 288v-96c69.12 0 136.95-23.78 190.95-66.98L480 98.58v282.84z"
1126+
d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
11271127
fill="currentColor"
11281128
style={Object {}}
11291129
transform="translate(-288 -256)"
@@ -1138,29 +1138,30 @@ exports[`Storyshots Components/Alert Announcement 1`] = `
11381138
<div
11391139
className="Alert__title"
11401140
>
1141-
Announcement title
1141+
Error title
11421142
</div>
11431143
<div
11441144
className="Alert__message"
1145+
tabIndex={-1}
11451146
>
1146-
Announcement message
1147+
Error message
11471148
</div>
11481149
</div>
11491150
</div>
11501151
`;
11511152

1152-
exports[`Storyshots Components/Alert Error 1`] = `
1153+
exports[`Storyshots Components/Alert Feature 1`] = `
11531154
<div
1154-
className="Alert Alert-error"
1155+
className="Alert Alert-feature"
11551156
style={null}
11561157
>
11571158
<div
11581159
className="Alert__icon"
11591160
>
11601161
<svg
11611162
aria-hidden="true"
1162-
className="svg-inline--fa fa-exclamation-triangle "
1163-
data-icon="exclamation-triangle"
1163+
className="svg-inline--fa fa-bullhorn "
1164+
data-icon="bullhorn"
11641165
data-prefix="fas"
11651166
focusable="false"
11661167
role="img"
@@ -1181,7 +1182,7 @@ exports[`Storyshots Components/Alert Error 1`] = `
11811182
transform="translate(0, 0) scale(1.125, 1.125) rotate(0 0 0)"
11821183
>
11831184
<path
1184-
d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
1185+
d="M576 240c0-23.63-12.95-44.04-32-55.12V32.01C544 23.26 537.02 0 512 0c-7.12 0-14.19 2.38-19.98 7.02l-85.03 68.03C364.28 109.19 310.66 128 256 128H64c-35.35 0-64 28.65-64 64v96c0 35.35 28.65 64 64 64h33.7c-1.39 10.48-2.18 21.14-2.18 32 0 39.77 9.26 77.35 25.56 110.94 5.19 10.69 16.52 17.06 28.4 17.06h74.28c26.05 0 41.69-29.84 25.9-50.56-16.4-21.52-26.15-48.36-26.15-77.44 0-11.11 1.62-21.79 4.41-32H256c54.66 0 108.28 18.81 150.98 52.95l85.03 68.03a32.023 32.023 0 0 0 19.98 7.02c24.92 0 32-22.78 32-32V295.13C563.05 284.04 576 263.63 576 240zm-96 141.42l-33.05-26.44C392.95 311.78 325.12 288 256 288v-96c69.12 0 136.95-23.78 190.95-66.98L480 98.58v282.84z"
11851186
fill="currentColor"
11861187
style={Object {}}
11871188
transform="translate(-288 -256)"
@@ -1196,13 +1197,12 @@ exports[`Storyshots Components/Alert Error 1`] = `
11961197
<div
11971198
className="Alert__title"
11981199
>
1199-
Error title
1200+
New feature alert!
12001201
</div>
12011202
<div
12021203
className="Alert__message"
1203-
tabIndex={-1}
12041204
>
1205-
Error message
1205+
Some context around new feature if needed.
12061206
</div>
12071207
</div>
12081208
</div>
@@ -1720,16 +1720,16 @@ Array [
17201720
</div>
17211721
</div>,
17221722
<div
1723-
className="Alert Alert-announcement"
1723+
className="Alert Alert-error"
17241724
style={null}
17251725
>
17261726
<div
17271727
className="Alert__icon"
17281728
>
17291729
<svg
17301730
aria-hidden="true"
1731-
className="svg-inline--fa fa-bullhorn "
1732-
data-icon="bullhorn"
1731+
className="svg-inline--fa fa-exclamation-triangle "
1732+
data-icon="exclamation-triangle"
17331733
data-prefix="fas"
17341734
focusable="false"
17351735
role="img"
@@ -1750,7 +1750,7 @@ Array [
17501750
transform="translate(0, 0) scale(1.125, 1.125) rotate(0 0 0)"
17511751
>
17521752
<path
1753-
d="M576 240c0-23.63-12.95-44.04-32-55.12V32.01C544 23.26 537.02 0 512 0c-7.12 0-14.19 2.38-19.98 7.02l-85.03 68.03C364.28 109.19 310.66 128 256 128H64c-35.35 0-64 28.65-64 64v96c0 35.35 28.65 64 64 64h33.7c-1.39 10.48-2.18 21.14-2.18 32 0 39.77 9.26 77.35 25.56 110.94 5.19 10.69 16.52 17.06 28.4 17.06h74.28c26.05 0 41.69-29.84 25.9-50.56-16.4-21.52-26.15-48.36-26.15-77.44 0-11.11 1.62-21.79 4.41-32H256c54.66 0 108.28 18.81 150.98 52.95l85.03 68.03a32.023 32.023 0 0 0 19.98 7.02c24.92 0 32-22.78 32-32V295.13C563.05 284.04 576 263.63 576 240zm-96 141.42l-33.05-26.44C392.95 311.78 325.12 288 256 288v-96c69.12 0 136.95-23.78 190.95-66.98L480 98.58v282.84z"
1753+
d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
17541754
fill="currentColor"
17551755
style={Object {}}
17561756
transform="translate(-288 -256)"
@@ -1765,19 +1765,20 @@ Array [
17651765
<div
17661766
className="Alert__title"
17671767
>
1768-
Announcement title
1768+
Error title
17691769
</div>
17701770
<div
17711771
className="Alert__message"
1772+
tabIndex={-1}
17721773
>
1773-
Announcement message
1774+
Error message
17741775
</div>
17751776
</div>
17761777
<div
17771778
className="Alert__action"
17781779
>
17791780
<a
1780-
className="Alert-announcement primary-action"
1781+
className="Alert-error primary-action"
17811782
href="https://www.userinterviews.com/"
17821783
rel="noopener noreferrer"
17831784
>
@@ -1788,7 +1789,7 @@ Array [
17881789
className="Alert__close"
17891790
>
17901791
<button
1791-
aria-label="close announcement"
1792+
aria-label="close error"
17921793
className="close"
17931794
onClick={[Function]}
17941795
type="button"
@@ -1814,7 +1815,7 @@ Array [
18141815
</div>
18151816
</div>,
18161817
<div
1817-
className="Alert Alert-error"
1818+
className="Alert Alert-warning"
18181819
style={null}
18191820
>
18201821
<div
@@ -1859,20 +1860,19 @@ Array [
18591860
<div
18601861
className="Alert__title"
18611862
>
1862-
Error title
1863+
Warning title
18631864
</div>
18641865
<div
18651866
className="Alert__message"
1866-
tabIndex={-1}
18671867
>
1868-
Error message
1868+
Warning message
18691869
</div>
18701870
</div>
18711871
<div
18721872
className="Alert__action"
18731873
>
18741874
<a
1875-
className="Alert-error primary-action"
1875+
className="Alert-warning primary-action"
18761876
href="https://www.userinterviews.com/"
18771877
rel="noopener noreferrer"
18781878
>
@@ -1883,7 +1883,7 @@ Array [
18831883
className="Alert__close"
18841884
>
18851885
<button
1886-
aria-label="close error"
1886+
aria-label="close warning"
18871887
className="close"
18881888
onClick={[Function]}
18891889
type="button"
@@ -1909,16 +1909,16 @@ Array [
19091909
</div>
19101910
</div>,
19111911
<div
1912-
className="Alert Alert-warning"
1912+
className="Alert Alert-feature"
19131913
style={null}
19141914
>
19151915
<div
19161916
className="Alert__icon"
19171917
>
19181918
<svg
19191919
aria-hidden="true"
1920-
className="svg-inline--fa fa-exclamation-triangle "
1921-
data-icon="exclamation-triangle"
1920+
className="svg-inline--fa fa-bullhorn "
1921+
data-icon="bullhorn"
19221922
data-prefix="fas"
19231923
focusable="false"
19241924
role="img"
@@ -1939,7 +1939,7 @@ Array [
19391939
transform="translate(0, 0) scale(1.125, 1.125) rotate(0 0 0)"
19401940
>
19411941
<path
1942-
d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
1942+
d="M576 240c0-23.63-12.95-44.04-32-55.12V32.01C544 23.26 537.02 0 512 0c-7.12 0-14.19 2.38-19.98 7.02l-85.03 68.03C364.28 109.19 310.66 128 256 128H64c-35.35 0-64 28.65-64 64v96c0 35.35 28.65 64 64 64h33.7c-1.39 10.48-2.18 21.14-2.18 32 0 39.77 9.26 77.35 25.56 110.94 5.19 10.69 16.52 17.06 28.4 17.06h74.28c26.05 0 41.69-29.84 25.9-50.56-16.4-21.52-26.15-48.36-26.15-77.44 0-11.11 1.62-21.79 4.41-32H256c54.66 0 108.28 18.81 150.98 52.95l85.03 68.03a32.023 32.023 0 0 0 19.98 7.02c24.92 0 32-22.78 32-32V295.13C563.05 284.04 576 263.63 576 240zm-96 141.42l-33.05-26.44C392.95 311.78 325.12 288 256 288v-96c69.12 0 136.95-23.78 190.95-66.98L480 98.58v282.84z"
19431943
fill="currentColor"
19441944
style={Object {}}
19451945
transform="translate(-288 -256)"
@@ -1954,19 +1954,19 @@ Array [
19541954
<div
19551955
className="Alert__title"
19561956
>
1957-
Warning title
1957+
New feature alert!
19581958
</div>
19591959
<div
19601960
className="Alert__message"
19611961
>
1962-
Warning message
1962+
Some context around new feature if needed
19631963
</div>
19641964
</div>
19651965
<div
19661966
className="Alert__action"
19671967
>
19681968
<a
1969-
className="Alert-warning primary-action"
1969+
className="Alert-feature primary-action"
19701970
href="https://www.userinterviews.com/"
19711971
rel="noopener noreferrer"
19721972
>
@@ -1977,7 +1977,7 @@ Array [
19771977
className="Alert__close"
19781978
>
19791979
<button
1980-
aria-label="close warning"
1980+
aria-label="close feature"
19811981
className="close"
19821982
onClick={[Function]}
19831983
type="button"

src/Alert/Alert.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const MessageTypes = {
1818
SUCCESS: 'success',
1919
INFO: 'info',
2020
ANNOUNCEMENT: 'announcement',
21+
FEATURE: 'feature',
2122
WARNING: 'warning',
2223
ERROR: 'error',
2324
};
@@ -40,6 +41,8 @@ const getAlertIcon = (type) => {
4041
);
4142
case MessageTypes.ANNOUNCEMENT:
4243
return (<FontAwesomeIcon icon={faBullhorn} transform="grow-2" />);
44+
case MessageTypes.FEATURE:
45+
return (<FontAwesomeIcon icon={faBullhorn} transform="grow-2" />);
4346
case MessageTypes.WARNING:
4447
return (<FontAwesomeIcon icon={faExclamationTriangle} transform="grow-2" />);
4548
case MessageTypes.ERROR:

src/Alert/Alert.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ import * as ComponentStories from './Alert.stories';
1414

1515
<Canvas of={ComponentStories.Success} />
1616

17-
### When to use
18-
- Reason 1
19-
- Reason 2
20-
21-
### When to not use
22-
- Reason 1
23-
- Reason 2
24-
2517
## Props
2618

2719
<ArgTypes of={Alert} />
@@ -41,6 +33,13 @@ page and are not affected by an event.
4133

4234
<Canvas of={ComponentStories.Info} />
4335

36+
### Feature
37+
38+
- Use when showcasing a new feature to a user.
39+
- NOTE: use this variant instead of the Announcement variant (this will be deprecated soon)
40+
41+
<Canvas of={ComponentStories.Feature} />
42+
4443
### Error
4544

4645
- Used when something did not go as planned, and action is needed to proceed.

src/Alert/Alert.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@
145145
}
146146
}
147147

148+
.Alert-feature {
149+
background-color: $ux-teal-100;
150+
color: $ux-teal-800;
151+
border: 2px solid $ux-teal-600;
152+
153+
.close {
154+
@include close-action($ux-teal-600, $ux-teal-800)
155+
}
156+
157+
.primary-action {
158+
@include primary-action($ux-teal-600, $ux-teal-700, $ux-white)
159+
}
160+
}
161+
148162
.Alert-warning {
149163
background-color: $ux-yellow-100;
150164
color: $ux-yellow-900;

src/Alert/Alert.stories.jsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ export const Info = () => (
4242
/>
4343
);
4444

45-
export const Announcement = () => (
45+
export const Feature = () => (
4646
<Alert
4747
id="3"
48-
message={text('Message', 'Announcement message')}
48+
message={text('Message', 'Some context around new feature if needed.')}
4949
removeBorderLeft={boolean('removeBorderLeft', false)}
50-
title={text('Title', 'Announcement title')}
51-
type={MessageTypes.ANNOUNCEMENT}
50+
title={text('Title', 'New feature alert!')}
51+
type={MessageTypes.FEATURE}
5252
/>
5353
);
5454

@@ -128,15 +128,6 @@ export const WithCallToAction = () => (
128128
type={MessageTypes.INFO}
129129
onDismiss={onDismiss}
130130
/>
131-
<Alert
132-
action={{ content: 'Primary action', url: 'https://www.userinterviews.com/' }}
133-
id="10"
134-
message="Announcement message"
135-
removeBorderLeft={boolean('removeBorderLeft', false)}
136-
title="Announcement title"
137-
type={MessageTypes.ANNOUNCEMENT}
138-
onDismiss={onDismiss}
139-
/>
140131
<Alert
141132
action={{ content: 'Primary action', url: 'https://www.userinterviews.com/' }}
142133
id="11"
@@ -155,6 +146,15 @@ export const WithCallToAction = () => (
155146
type={MessageTypes.WARNING}
156147
onDismiss={onDismiss}
157148
/>
149+
<Alert
150+
action={{ content: 'Primary action', url: 'https://www.userinterviews.com/' }}
151+
id="13"
152+
message="Some context around new feature if needed"
153+
removeBorderLeft={boolean('removeBorderLeft', false)}
154+
title="New feature alert!"
155+
type={MessageTypes.FEATURE}
156+
onDismiss={onDismiss}
157+
/>
158158

159159
<p>Custom CTA via <code>message</code> prop</p>
160160
<Alert

0 commit comments

Comments
 (0)