From 1cfb4880fab0fd7a8e5ebd413699f5745c7870c3 Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Thu, 19 Oct 2023 19:01:16 +0200 Subject: [PATCH] Add helperText prop to Filter interface Signed-off-by: Radoslaw Szwajkowski --- packages/common/src/components/Filter/types.ts | 2 ++ packages/common/src/components/FilterGroup/FilterFromDef.tsx | 1 + packages/common/src/utils/types.ts | 2 ++ 3 files changed, 5 insertions(+) diff --git a/packages/common/src/components/Filter/types.ts b/packages/common/src/components/Filter/types.ts index 2218db25b..27a314619 100644 --- a/packages/common/src/components/Filter/types.ts +++ b/packages/common/src/components/Filter/types.ts @@ -41,4 +41,6 @@ export interface FilterTypeProps { * Language to be used for locale sensitive sorting/filtering. Defaults to 'en'. */ resolvedLanguage: string; + /** Text that explains how to use the filter. */ + helperText?: string | React.ReactNode; } diff --git a/packages/common/src/components/FilterGroup/FilterFromDef.tsx b/packages/common/src/components/FilterGroup/FilterFromDef.tsx index 2e981e8c0..79ecd7bd3 100644 --- a/packages/common/src/components/FilterGroup/FilterFromDef.tsx +++ b/packages/common/src/components/FilterGroup/FilterFromDef.tsx @@ -44,6 +44,7 @@ export const FilterFromDef = ({ supportedValues={def.values} supportedGroups={def.groups} resolvedLanguage={resolvedLanguage} + helperText={def.helperText} /> ) ); diff --git a/packages/common/src/utils/types.ts b/packages/common/src/utils/types.ts index 8f09beeea..7f30aaebe 100644 --- a/packages/common/src/utils/types.ts +++ b/packages/common/src/utils/types.ts @@ -1,3 +1,4 @@ +import React from 'react'; export interface EnumGroup { groupId: string; label: string; @@ -20,6 +21,7 @@ export interface FilterDef { // override default behavior if there are no filters provided by the user // by default missing/empty filters result in positive match (vacuous truth) defaultValues?: string[]; + helperText?: string | React.ReactNode; } type OpenApiJsonPath = string | ((resourceData: unknown) => unknown);