Skip to content

Commit 59c3610

Browse files
committed
Add empty state for Dashboard widget
1 parent 5a42411 commit 59c3610

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

src/components/Dashboard/SlowQueries/SlowQueries.stories.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,16 @@ export const Default: Story = {
8989
}
9090
}
9191
};
92+
93+
export const Empty: Story = {
94+
args: {
95+
data: {
96+
data: {
97+
totalCount: 0,
98+
entries: []
99+
},
100+
type: "SlowQuery",
101+
error: null
102+
}
103+
}
104+
};

src/components/Dashboard/SlowQueries/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Pagination } from "../../common/Pagination";
99
import { Toggle } from "../../common/Toggle";
1010
import { ToggleValue } from "../../common/Toggle/types";
1111
import { Tooltip } from "../../common/Tooltip";
12+
import { LightBulbSmallCrossedIcon } from "../../common/icons/LightBulbSmallCrossedIcon";
1213
import { SnailIcon } from "../../common/icons/SnailIcon";
1314
import { WarningCircleLargeIcon } from "../../common/icons/WarningCircleLargeIcon";
1415
import { actions } from "../actions";
@@ -190,7 +191,12 @@ export const SlowQueries = (props: SlowQueriesProps) => {
190191
{error}
191192
</s.ErrorMessage>
192193
) : (
193-
<span>No data</span>
194+
<>
195+
<s.EmptyStateIconContainer>
196+
<LightBulbSmallCrossedIcon color={"currentColor"} size={72} />
197+
</s.EmptyStateIconContainer>
198+
<span>No data</span>
199+
</>
194200
)}
195201
</s.EmptyStateContainer>
196202
) : (

src/components/Dashboard/SlowQueries/styles.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,34 @@ export const EmptyStateContainer = styled.div`
113113
flex-direction: column;
114114
align-items: center;
115115
justify-content: center;
116+
gap: 8px;
116117
font-size: 14px;
117118
flex-grow: 1;
119+
color: #dadada;
120+
`;
121+
122+
export const EmptyStateIconContainer = styled.div`
123+
width: 72px;
124+
height: 72px;
125+
border-radius: 50%;
126+
color: ${({ theme }) => {
127+
switch (theme.mode) {
128+
case "light":
129+
return "#fbfdff";
130+
case "dark":
131+
case "dark-jetbrains":
132+
return "#9b9b9b";
133+
}
134+
}};
135+
background: ${({ theme }) => {
136+
switch (theme.mode) {
137+
case "light":
138+
return "#d0d6eb";
139+
case "dark":
140+
case "dark-jetbrains":
141+
return "#323334";
142+
}
143+
}};
118144
`;
119145

120146
export const ErrorMessage = styled.span`

0 commit comments

Comments
 (0)