Skip to content

Commit

Permalink
RC #291 - Adding "onChange" prop to FacetTimeline component
Browse files Browse the repository at this point in the history
  • Loading branch information
dleadbetter committed Aug 12, 2024
1 parent 47bc8e3 commit 86c8e4e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core-data/src/components/FacetTimeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ type Props = {
*/
description?: boolean,

/**
* Callback fired when the range or min/max properties are changed.
*/
onChange?: (range: [number, number], minMax: [number, number]) => void,

/**
* Callback fired when the event popover is clicked.
*/
Expand Down Expand Up @@ -136,6 +141,10 @@ const FacetTimeline = (props: Props) => {
.fetchAll({ min_year: range[0], max_year: range[1] })
.then(onLoad)
));

if (props.onChange) {
props.onChange(range, [min, max]);
}
}, [max, min, range]);

/**
Expand Down

0 comments on commit 86c8e4e

Please sign in to comment.