Skip to content

Commit

Permalink
Update TimeframeMenuComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyandreevsky committed Oct 21, 2024
1 parent 37827b6 commit 1f8851a
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions packages/frontend/src/components/charts/TimeframeMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const chartConfig = {
}
}

const TimeframeMenu = forwardRef(function TimeframeMenu ({ config, isActive, changeCallback, openStateCallback, className }, ref) {
const TimeframeMenu = forwardRef(function TimeframeMenu ({ config, changeCallback, className }, ref) {
const [timespan, setTimespan] = useState(chartConfig.timespan.values[chartConfig.timespan.defaultIndex])
const [menuIsOpen, setMenuIsOpen] = useState(false)

Expand All @@ -36,14 +36,6 @@ const TimeframeMenu = forwardRef(function TimeframeMenu ({ config, isActive, cha
if (typeof changeCallback === 'function') changeCallback(value)
}

useEffect(() => {
if (!isActive) setMenuIsOpen(false)
}, [isActive])

useEffect(() => {
if (typeof openStateCallback === 'function') openStateCallback(menuIsOpen)
}, [menuIsOpen])

const calendarHandler = (value) => {}

return (
Expand All @@ -57,10 +49,7 @@ const TimeframeMenu = forwardRef(function TimeframeMenu ({ config, isActive, cha
{config.timespan.values.map((iTimespan, i) => (
<Button
className={`TimeframeMenu__ValueButton ${iTimespan.range === timespan.range ? 'TimeframeMenu__ValueButton--Active' : ''}`}
onClick={() => {
changeHandler(iTimespan)
setMenuIsOpen(false)
}}
onClick={() => changeHandler(iTimespan)}
key={i}
size={'xs'}
>
Expand Down

0 comments on commit 1f8851a

Please sign in to comment.