From 224e8bfab9ca4034bc4518eb07927f228ee3b890 Mon Sep 17 00:00:00 2001 From: Remi Blom-Ohlsen Date: Thu, 25 Jan 2024 18:28:29 +0100 Subject: [PATCH] Add message in FilterPanel if it is empty #1444 --- .../src/components/FilterPanel/FilterPanel.tsx | 9 +++++++++ .../shared-library/src/loc/mystrings.d.ts | 2 ++ SharePointFramework/shared-library/src/loc/nb-no.js | 2 ++ 3 files changed, 13 insertions(+) diff --git a/SharePointFramework/shared-library/src/components/FilterPanel/FilterPanel.tsx b/SharePointFramework/shared-library/src/components/FilterPanel/FilterPanel.tsx index a0e3d5e18..809c18879 100644 --- a/SharePointFramework/shared-library/src/components/FilterPanel/FilterPanel.tsx +++ b/SharePointFramework/shared-library/src/components/FilterPanel/FilterPanel.tsx @@ -5,6 +5,8 @@ import { IFilterPanelProps } from './types' import styles from './FilterPanel.module.scss' import { useId, IdPrefixProvider, FluentProvider } from '@fluentui/react-components' import { customLightTheme } from '../../util' +import { UserMessage } from '../UserMessage' +import strings from 'SharedLibraryStrings' export const FilterPanel: FC = (props) => { const fluentProviderId = useId('fp-filter-panel') @@ -14,6 +16,13 @@ export const FilterPanel: FC = (props) => {
+ {props.filters.length === 0 && ( + + )} {props.filters .filter((f) => f.items.length > 1) .map((f, idx) => ( diff --git a/SharePointFramework/shared-library/src/loc/mystrings.d.ts b/SharePointFramework/shared-library/src/loc/mystrings.d.ts index 42ec335eb..7add46dd2 100644 --- a/SharePointFramework/shared-library/src/loc/mystrings.d.ts +++ b/SharePointFramework/shared-library/src/loc/mystrings.d.ts @@ -35,6 +35,8 @@ declare interface ISharedLibraryStrings { ErrorTitle: string FiltersString: string FilterText: string + FilterPanelEmptyTitle: string + FilterPanelEmptyMessage: string GroupByLabel: string LastPublishedStatusreport: string LoadingText: string diff --git a/SharePointFramework/shared-library/src/loc/nb-no.js b/SharePointFramework/shared-library/src/loc/nb-no.js index 3165273c7..68c754f18 100644 --- a/SharePointFramework/shared-library/src/loc/nb-no.js +++ b/SharePointFramework/shared-library/src/loc/nb-no.js @@ -35,6 +35,8 @@ define([], function () { ErrorTitle: 'Det har oppstått en feil', FiltersString: 'Filtre', FilterText: 'Filtrer', + FilterPanelEmptyTitle: 'Ingen data å filtrere på', + FilterPanelEmptyMessage: 'Det er ingen data å filtrere på. Det kan være at ingen filtre er definert, eller at det ikke er noe data å filtrere på.', GroupByLabel: 'Grupper etter', LastPublishedStatusreport: 'Gå til siste statusrapport', LoadingText: 'Laster...',