Skip to content

Commit 898d9b5

Browse files
committed
fixed issue with margin being undefined
> > Co-authored-by: Nkmai <[email protected]> Co-authored-by: lind-tania <[email protected]> Co-authored-by: rtviner <[email protected]> Co-authored-by: caitlinchan23 <[email protected]>
1 parent 8f0d608 commit 898d9b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,21 @@ export default function ComponentMap({
4242
// imported props to be used to display the dendrogram
4343
width: totalWidth,
4444
height: totalHeight,
45-
margin: defaultMargin,
45+
margin = defaultMargin,
4646
snapshots: snapshots,
4747
}: LinkTypesProps) {
4848

4949
const [{ tabs, currentTab }, dispatch] = useStoreContext();
5050
// This is where we select the last object in the snapshots array from props to allow hierarchy to parse the data for render on the component map per hierarchy layout specifications.
5151
const lastNode = snapshots.length - 1;
5252
const data: {} = snapshots[lastNode];
53+
5354
// importing custom hooks for the selection tabs.
5455
const [layout, setLayout] = useState('cartesian');
5556
const [orientation, setOrientation] = useState('horizontal');
5657
const [linkType, setLinkType] = useState('diagonal');
5758
const [stepPercent, setStepPercent] = useState(10);
59+
5860
// Declared this variable and assigned it to the useForceUpdate function that forces a state to change causing that component to re-render and display on the map
5961
const forceUpdate = useForceUpdate();
6062
// setting the margins for the Map to render in the tab window.
@@ -101,7 +103,6 @@ export default function ComponentMap({
101103
setStepPercent={setStepPercent}
102104
/>
103105

104-
105106
<svg width={totalWidth} height={totalHeight}>
106107
<LinearGradient id='links-gradient' from='#fd9b93' to='#fe6e9e' />
107108
<rect width={totalWidth} height={totalHeight} rx={14} fill='#242529'/>
@@ -125,7 +126,6 @@ export default function ComponentMap({
125126
))}
126127

127128
{tree.descendants().map((node, key) => {
128-
// const width = (node.data.name.length) + 70;
129129
const widthFunc = (name) => {
130130
let nodeLength = name.length;
131131
if (nodeLength < 5) return nodeLength + 40;
@@ -162,7 +162,7 @@ export default function ComponentMap({
162162
}}
163163
/>
164164
)}
165-
{/* This creates the rectangle boxes for each component and sets it relative position to other parent nodes of the same level. */}
165+
{/* This creates the rectangle boxes for each component and sets it relative position to other parent nodes of the same level.*/}
166166
{node.depth !== 0 && (
167167
<rect
168168
height={height}

0 commit comments

Comments
 (0)