Skip to content

Commit

Permalink
feat: add no dashboards found message
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Jan 3, 2025
1 parent 8c8a229 commit 0741950
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/DashboardsBar/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,19 @@ const Content = ({
}
}

const getChips = () =>
getFilteredDashboards(dashboards, filterText).map((dashboard) => (
const getChips = () => {
const filteredList = getFilteredDashboards(dashboards, filterText)

if (filteredList.length === 0) {
return (
<span className={classes.noDashboardsMessage}>
{i18n.t('No dashboards found for "{{filterText}}"', {
filterText,
})}
</span>
)
}
return filteredList.map((dashboard) => (
<Chip
key={dashboard.id}
label={dashboard.displayName}
Expand All @@ -50,6 +61,7 @@ const Content = ({
onClick={onChipClicked}
/>
))
}

const getControlsSmall = () => (
<div className={classes.controlsSmall}>
Expand Down
11 changes: 11 additions & 0 deletions src/components/DashboardsBar/styles/Content.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
gap: 6px;
}

.noDashboardsMessage {
padding-left: 6px;
color: #4A5768;
font-size: 12px;
display: inline-flex;
-webkit-box-align: center;
align-items: center;
height: 32px;
line-height: 16px;
user-select: none;
}
@media only screen and (max-width: 480px) {
.newLink {
display: none;
Expand Down

0 comments on commit 0741950

Please sign in to comment.