mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* 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
24 lines
581 B
TypeScript
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,
|
|
};
|
|
}
|