Skip to content

Commit

Permalink
✨ - feat: intergrate DateRangeInput with DataGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Oct 10, 2024
1 parent 6f074a4 commit eadd13c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/components/data/datagrid/datagridthead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ export const DataGridTHead: React.FC = () => {
{field.filterable !== false && (
<FormControl
aria-label={_labelFilterField}
icon={!field.options && <Outline.MagnifyingGlassIcon />}
icon={
!field.options &&
!field.type.includes("date") && (
<Outline.MagnifyingGlassIcon />
)
}
form={`${dataGridId}-filter-form`}
name={field.filterLookup || field.name}
options={field.options}
Expand Down
6 changes: 5 additions & 1 deletion src/components/form/daterangeinput/daterangeinput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import "./daterangeinput.scss";
import { TRANSLATIONS } from "./daterangeinput.translations";

export type DateRangeInputProps = Omit<DateInputProps, "type" | "value"> & {
/** Component to use as icon. */
icon?: React.ReactNode;

/** Whether a date or date range should be provided. */
type?: "daterange";

Expand All @@ -26,6 +29,7 @@ export type DateRangeInputProps = Omit<DateInputProps, "type" | "value"> & {
*/
export const DateRangeInput: React.FC<DateRangeInputProps> = ({
form,
icon = <Outline.CodeBracketSquareIcon />,
labelStartDate,
labelEndDate,
name,
Expand Down Expand Up @@ -204,7 +208,7 @@ export const DateRangeInput: React.FC<DateRangeInputProps> = ({
value={valuesState?.[0]}
onChange={handleStartChange}
/>
<Outline.CodeBracketSquareIcon />{" "}
{icon}
<DateInput
{...props}
label={
Expand Down

0 comments on commit eadd13c

Please sign in to comment.