11import { Meta } from "@storybook/react-vite" ;
22import "@macrostrat/style-system" ;
3- import { useArgs } from "storybook/preview-api" ;
4- import { useCallback } from "react" ;
3+ import { useCorrelationLine } from "./utils" ;
54import {
65 ColumnCorrelationMap ,
76 ColumnCorrelationProvider ,
@@ -18,7 +17,6 @@ import styles from "./stories.module.sass";
1817import { CorrelationChart , CorrelationChartProps } from "../main" ;
1918import { ErrorBoundary , useAsyncMemo } from "@macrostrat/ui-components" ;
2019import { OverlaysProvider } from "@blueprintjs/core" ;
21- import { parseLineFromString , stringifyLine } from "../hash-string" ;
2220import { EnvironmentColoredUnitComponent } from "../../units" ;
2321import { scaleLinear , scalePow } from "d3-scale" ;
2422
@@ -179,27 +177,6 @@ export default {
179177 } ,
180178} as Meta < typeof CorrelationStoryUI > ;
181179
182- function useCorrelationLine ( ) {
183- const [ { focusedLine, selectedUnit } , updateArgs ] = useArgs ( ) ;
184- const setFocusedLine = ( line ) => {
185- updateArgs ( { focusedLine : stringifyLine ( line ) } ) ;
186- } ;
187-
188- const setSelectedUnit = useCallback (
189- ( selectedUnit ) => {
190- updateArgs ( { selectedUnit } ) ;
191- } ,
192- [ updateArgs ] ,
193- ) ;
194-
195- return {
196- focusedLine : parseLineFromString ( focusedLine ) ,
197- setFocusedLine,
198- selectedUnit,
199- setSelectedUnit,
200- } ;
201- }
202-
203180function Template ( args ) {
204181 return h ( CorrelationStoryUI , {
205182 ...args ,
0 commit comments