Skip to content

Commit a3b7bb4

Browse files
Merge release/2.4.4 into main branch (#1133)
* add image support for EmptyState (#1132)
1 parent edc4ecd commit a3b7bb4

File tree

9 files changed

+95
-4
lines changed

9 files changed

+95
-4
lines changed

.storybook/webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ module.exports = function({ config }) {
1616
'sass-loader'
1717
],
1818
include: path.resolve(__dirname, '../')
19+
},
20+
{
21+
test: /\\.(png|jp(e*)g|svg|gif)$/,
22+
use: ['file-loader'],
1923
});
2024

2125
return config;

package.json

Lines changed: 2 additions & 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.4.3",
3+
"version": "2.4.4",
44
"dependencies": {
55
"@tiptap/core": "^2.0.3",
66
"@tiptap/extension-bold": "^2.0.3",
@@ -135,6 +135,7 @@
135135
"eslint-plugin-react": "^7.18.3",
136136
"eslint-plugin-react-hooks": "^2.5.1",
137137
"eslint-utils": "^1.4.3",
138+
"file-loader": "^6.2.0",
138139
"jest": "^27.4.6",
139140
"jest-css-modules-transform": "^4.3.0",
140141
"node-sass": "^8.0.0",

spec/__snapshots__/Storyshots.test.js.snap

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6760,6 +6760,60 @@ exports[`Storyshots Components/EmptyState Full Width 1`] = `
67606760
</div>
67616761
`;
67626762

6763+
exports[`Storyshots Components/EmptyState Image 1`] = `
6764+
<div
6765+
className="EmptyState EmptyState--margin-top--sm"
6766+
>
6767+
<div
6768+
className="EmptyState__content"
6769+
>
6770+
<div
6771+
className="EmptyState__image"
6772+
>
6773+
<img
6774+
alt=""
6775+
src={Object {}}
6776+
/>
6777+
</div>
6778+
<h4
6779+
className="EmptyState__title Heading Heading--lg Heading--bold"
6780+
style={
6781+
Object {
6782+
"textAlign": "center",
6783+
}
6784+
}
6785+
>
6786+
No participants to display
6787+
</h4>
6788+
<p
6789+
className="EmptyState__subtitle Text Text--md Text--regular"
6790+
style={
6791+
Object {
6792+
"textAlign": "center",
6793+
}
6794+
}
6795+
>
6796+
Start recruiting from User Interviews' panel of 6M+ users and kick off your research!
6797+
</p>
6798+
<div
6799+
className="EmptyState__actions"
6800+
>
6801+
<div
6802+
className="EmptyState__actions__primary-action"
6803+
>
6804+
<button
6805+
className="Button btn btn-primary"
6806+
disabled={false}
6807+
type="button"
6808+
>
6809+
Start recruiting
6810+
</button>
6811+
</div>
6812+
</div>
6813+
</div>
6814+
</div>
6815+
`;
6816+
67636817
exports[`Storyshots Components/EmptyState Margin Top 1`] = `
67646818
<div
67656819
className="EmptyState EmptyState--margin-top--sm"

src/EmptyState/EmptyState.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import '../../scss/theme';
22

33
$empty-state-max-width: 400px;
4-
$empty-state-max-image-height: 160px;
54

65
$empty-state-margin-top-sm: 64px;
76
$empty-state-margin-top-md: 96px;
@@ -10,6 +9,8 @@ $empty-state-margin-top-lg: 200px;
109
$empty-state-title-margin-bottom: $synth-spacing-4;
1110
$empty-state-subtitle-margin-bottom: $synth-spacing-4;
1211

12+
$empty-state-image-max-height: 150px;
13+
1314
.EmptyState {
1415
display: flex;
1516
flex-direction: row;
@@ -41,8 +42,12 @@ $empty-state-subtitle-margin-bottom: $synth-spacing-4;
4142
display: flex;
4243
justify-content: center;
4344

44-
margin-bottom: $synth-spacing-4;
45-
max-height: $empty-state-max-image-height;
45+
margin-bottom: $synth-spacing-8;
46+
47+
img {
48+
max-height: $empty-state-image-max-height;
49+
width: auto;
50+
}
4651
}
4752

4853
&__title {

src/EmptyState/EmptyState.stories.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { faPlus } from '@fortawesome/pro-regular-svg-icons';
55

66
import Button from 'src/Button';
77

8+
import ProfileSearchImage from './profile_search.png';
9+
810
import EmptyState from './EmptyState';
911

1012
const meta: Meta<typeof EmptyState> = {
@@ -30,6 +32,15 @@ export const PrimaryAction: Story = {
3032
},
3133
};
3234

35+
export const Image: Story = {
36+
args: {
37+
image: ProfileSearchImage,
38+
primaryAction: <Button variant="primary">Start recruiting</Button>,
39+
subtitle: `Start recruiting from User Interviews' panel of 6M+ users and kick off your research!`,
40+
title: 'No participants to display',
41+
},
42+
};
43+
3344
export const FullWidth: Story = {
3445
args: {
3546
fullWidth: true,

src/EmptyState/EmptyState.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import './EmptyState.scss';
1010
export interface EmptyStateProps {
1111
className?: string;
1212
fullWidth?: boolean;
13+
image?: string;
1314
marginTop?: 'sm' | 'md' | 'lg' | 'none';
1415
primaryAction?: ReactNode;
1516
subtitle?: string | ReactNode;
@@ -19,6 +20,7 @@ export interface EmptyStateProps {
1920
const EmptyState = ({
2021
className,
2122
fullWidth = false,
23+
image,
2224
marginTop = 'sm',
2325
primaryAction,
2426
subtitle,
@@ -35,6 +37,11 @@ const EmptyState = ({
3537
fullWidth && 'EmptyState--full-width',
3638
)}
3739
>
40+
{image && (
41+
<div className="EmptyState__image">
42+
<img alt="" src={image} />
43+
</div>
44+
)}
3845
{title && (
3946
<Heading
4047
className="EmptyState__title"

src/EmptyState/profile_search.png

57.3 KB
Loading

src/ts_module_shims.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
declare module '*.module.scss';
2+
declare module '*.png';

yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6791,6 +6791,14 @@ file-entry-cache@^6.0.1:
67916791
dependencies:
67926792
flat-cache "^3.0.4"
67936793

6794+
file-loader@^6.2.0:
6795+
version "6.2.0"
6796+
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
6797+
integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==
6798+
dependencies:
6799+
loader-utils "^2.0.0"
6800+
schema-utils "^3.0.0"
6801+
67946802
67956803
version "2.3.0"
67966804
resolved "https://registry.yarnpkg.com/file-system-cache/-/file-system-cache-2.3.0.tgz#201feaf4c8cd97b9d0d608e96861bb6005f46fe6"

0 commit comments

Comments
 (0)