Skip to content

Commit 06ee58c

Browse files
authored
feat: Empty state variations Logic (#598)
1 parent 032d597 commit 06ee58c

6 files changed

+99
-7
lines changed
Loading
Loading

packages/fuselage/src/components/States/States.stories.tsx

+75-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
StatesActions,
1313
StatesAction,
1414
} from '.';
15-
import { Box } from '..';
15+
import { Box, Icon } from '..';
1616

1717
export default {
1818
title: 'States/States',
@@ -77,6 +77,7 @@ export const ActionButton = () => (
7777
</States>
7878
</Box>
7979
);
80+
8081
export const ActionButtonWithNoSuggestions = () => (
8182
<Box>
8283
<States>
@@ -92,3 +93,76 @@ export const ActionButtonWithNoSuggestions = () => (
9293
</States>
9394
</Box>
9495
);
96+
97+
export const Variations = () => (
98+
<Box>
99+
<States>
100+
<StatesIcon name='circle-exclamation' />
101+
<StatesTitle>Connection error</StatesTitle>
102+
<StatesSubtitle>
103+
Cannot connect to internet or your workspace may be an offline install.{' '}
104+
<br /> Contact your workspace admin for more information.
105+
</StatesSubtitle>
106+
<StatesActions>
107+
<StatesAction>
108+
<Icon name='reload' /> Reload
109+
</StatesAction>
110+
</StatesActions>
111+
</States>
112+
113+
<States>
114+
<StatesIcon name='circle-exclamation' variation='danger' />
115+
<StatesTitle>Connection error</StatesTitle>
116+
<StatesSubtitle>
117+
Cannot connect to internet or your workspace may be an offline install.{' '}
118+
<br /> Contact your workspace admin for more information.
119+
</StatesSubtitle>
120+
<StatesActions>
121+
<StatesAction>
122+
<Icon name='reload' /> Reload
123+
</StatesAction>
124+
</StatesActions>
125+
</States>
126+
<States>
127+
<StatesIcon name='circle-exclamation' variation='primary' />
128+
<StatesTitle>Connection error</StatesTitle>
129+
<StatesSubtitle>
130+
Cannot connect to internet or your workspace may be an offline install.{' '}
131+
<br /> Contact your workspace admin for more information.
132+
</StatesSubtitle>
133+
<StatesActions>
134+
<StatesAction>
135+
<Icon name='reload' /> Reload
136+
</StatesAction>
137+
</StatesActions>
138+
</States>
139+
140+
<States>
141+
<StatesIcon name='magnifier' variation='success' />
142+
<StatesTitle>Connection error</StatesTitle>
143+
<StatesSubtitle>
144+
Cannot connect to internet or your workspace may be an offline install.{' '}
145+
<br /> Contact your workspace admin for more information.
146+
</StatesSubtitle>
147+
<StatesActions>
148+
<StatesAction>
149+
<Icon name='reload' /> Reload
150+
</StatesAction>
151+
</StatesActions>
152+
</States>
153+
154+
<States>
155+
<StatesIcon name='magnifier' variation='warning' />
156+
<StatesTitle>Connection error</StatesTitle>
157+
<StatesSubtitle>
158+
Cannot connect to internet or your workspace may be an offline install.{' '}
159+
<br /> Contact your workspace admin for more information.
160+
</StatesSubtitle>
161+
<StatesActions>
162+
<StatesAction>
163+
<Icon name='reload' /> Reload
164+
</StatesAction>
165+
</StatesActions>
166+
</States>
167+
</Box>
168+
);

packages/fuselage/src/components/States/States.styles.scss

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
@use '../../styles/colors.scss';
44
@use '../../styles/typography.scss';
55

6+
$variants: (
7+
'success': colors.success(600),
8+
'danger': colors.danger(600),
9+
'warning': colors.warning(600),
10+
'primary': colors.primary(600),
11+
);
12+
613
.rcx-states {
714
display: flex;
815
flex-direction: column;
@@ -17,9 +24,17 @@
1724
margin-block-end: lengths.margin(16);
1825
padding: lengths.margin(16);
1926

27+
color: colors.foreground(info);
28+
2029
border-radius: 100%;
2130

2231
background-color: colors.neutral(200);
32+
33+
@each $name, $color in $variants {
34+
&--#{$name} {
35+
color: theme('states-icons-color-#{$name}', $color);
36+
}
37+
}
2338
}
2439

2540
&__title {
@@ -40,7 +55,7 @@
4055
align-items: center;
4156

4257
width: 100%;
43-
max-width: 410px;
58+
max-width: 462px;
4459

4560
margin: 0;
4661
padding: 0;

packages/fuselage/src/components/States/StatesIcon.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import { Icon } from '../Icon';
44

55
const StatesIcon: FC<{
66
name: ComponentProps<typeof Icon>['name'];
7-
// variation?: 'danger';
8-
}> = ({ name }) => (
9-
<div className='rcx-states__icon'>
10-
<Icon name={name} size='x32' />
11-
</div>
7+
variation?: 'danger' | 'success' | 'warning' | 'primary';
8+
}> = ({ name, variation }) => (
9+
<Icon
10+
rcx-states__icon
11+
className={variation && `rcx-states__icon--${variation}`}
12+
name={name}
13+
size='x32'
14+
/>
1215
);
1316

1417
export default StatesIcon;

0 commit comments

Comments
 (0)