Skip to content

Commit

Permalink
Dev-9125 Customizable Apply Filter Button Label (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-DiPaolo authored Oct 15, 2024
1 parent 16682a6 commit 98dfbb9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/core/components/EditorPanel/Inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type TextFieldProps = {
value: string | number
type?: 'text' | 'number' | 'textarea' | 'date'
min?: number
maxLength?: number
max?: number
i?: number
id?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
AccordionItemPanel
} from 'react-accessible-accordion'
import { useContext, useMemo, useState } from 'react'
import { CheckBox, Select } from '@cdc/core/components/EditorPanel/Inputs'
import { CheckBox, Select, TextField } from '@cdc/core/components/EditorPanel/Inputs'
import Tooltip from '@cdc/core/components/ui/Tooltip'
import Icon from '@cdc/core/components/ui/Icon'
import FieldSetWrapper from '@cdc/core/components/EditorPanel/FieldSetWrapper'
Expand Down Expand Up @@ -162,6 +162,16 @@ const DashboardFiltersEditor: React.FC<DashboardFitlersEditorProps> = ({ vizConf
</Tooltip>
}
/>
{vizConfig.filterBehavior === 'Apply Button' && (
<TextField
label='Apply Filter Button Text'
maxLength={20}
value={vizConfig.applyFiltersButtonText}
updateField={(_section, _subsection, _key, value) => {
updateConfig({ ...vizConfig, applyFiltersButtonText: value })
}}
/>
)}
{vizConfig.filterBehavior === 'Filter Change' && (
<CheckBox
label='Auto Load'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const DashboardFiltersWrapper: React.FC<DashboardFiltersProps> = ({
handleOnChange={handleOnChange}
/>
{visualizationConfig.filterBehavior === FilterBehavior.Apply && !visualizationConfig.autoLoad && (
<button onClick={applyFilters}>GO!</button>
<button onClick={applyFilters}>{visualizationConfig.applyFiltersButtonText || 'GO!'}</button>
)}
</div>
</Layout.Responsive>
Expand Down
1 change: 1 addition & 0 deletions packages/dashboard/src/types/DashboardFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonVisualizationProperties } from '@cdc/core/types/Visualization'

export type DashboardFilters = {
sharedFilterIndexes: number[]
applyFiltersButtonText: string
autoLoad?: boolean
type: 'dashboardFilters'
} & CommonVisualizationProperties

0 comments on commit 98dfbb9

Please sign in to comment.