Skip to content

Commit 218967a

Browse files
committed
included conditional rendering of test ax legend component
1 parent fce58c6 commit 218967a

File tree

1 file changed

+18
-0
lines changed
  • src/app/components/StateRoute/AxMap

1 file changed

+18
-0
lines changed

src/app/components/StateRoute/AxMap/Ax.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import React, { useState } from 'react';
2+
import { useDispatch, useSelector } from 'react-redux';
23
import { Group } from '@visx/group';
34
import { hierarchy, Tree } from '@visx/hierarchy';
45
import { LinearGradient } from '@visx/gradient';
56
import { pointRadial } from 'd3-shape';
67
import { useTooltipInPortal } from '@visx/tooltip';
78
import LinkControls from './axLinkControls';
89
import getLinkComponent from './getAxLinkComponents';
10+
import AxLegend from './axLegend';
11+
import { renderAxLegend } from '../../../slices/AxSlices/axLegendSlice';
12+
import type { RootState } from '../../../store';
913

1014
const theme = {
1115
scheme: 'monokai',
@@ -274,6 +278,10 @@ export default function AxTree(props) {
274278
scroll: true, // when tooltip containers are scrolled, this will correctly update the Tooltip position
275279
});
276280

281+
// ax Legend
282+
const { axLegendButtonClicked } = useSelector((state: RootState) => state.axLegend);
283+
const dispatch = useDispatch();
284+
277285
return totalWidth < 10 ? null : (
278286
<div>
279287
<LinkControls
@@ -477,6 +485,16 @@ export default function AxTree(props) {
477485
</Tree>
478486
</Group>
479487
</svg>
488+
489+
{/* ax Legend */}
490+
<div>
491+
<button id='axLegendButton' style={{position: 'absolute'}} onClick={() => dispatch(renderAxLegend())}></button>
492+
493+
{ axLegendButtonClicked ?
494+
<AxLegend /> : ''
495+
}
496+
</div>
497+
480498
</div>
481499
);
482500
}

0 commit comments

Comments
 (0)