Files
tom goriunovandGitHub 5c0c18149d Move charts to toolkit and improve color mode hook (#3075)
* move charts to toolkit

* refactor imports

* fix tests

* change the behavior of the color mode hook and add the noWatermark prop

* fix gas tracker test and fix toolkit build
2025-10-21 17:33:04 +02:00

24 lines
581 B
TypeScript

import React from 'react';
export function useChartZoom() {
const [ isZoomResetInitial, setIsZoomResetInitial ] = React.useState(true);
const [ zoomRange, setZoomRange ] = React.useState<[ Date, Date ] | undefined>();
const handleZoom = React.useCallback((range: [ Date, Date ]) => {
setZoomRange(range);
setIsZoomResetInitial(false);
}, []);
const handleZoomReset = React.useCallback(() => {
setZoomRange(undefined);
setIsZoomResetInitial(true);
}, []);
return {
isZoomResetInitial,
zoomRange,
handleZoom,
handleZoomReset,
};
}