mirror of
https://github.com/maciejpedzich/six-degs-of-f1.git
synced 2024-11-27 15:55:47 +01:00
Remove redundant options prop from Graph component
This commit is contained in:
parent
0e72f6ce97
commit
b9a2b2e85c
@ -4,16 +4,14 @@ import type { Node, Edge, Options } from 'vis-network/esnext';
|
||||
interface Props {
|
||||
nodes: Node[];
|
||||
edges: Edge[];
|
||||
options?: Options;
|
||||
}
|
||||
|
||||
const { nodes, edges, options = {} } = Astro.props;
|
||||
const { nodes, edges } = Astro.props;
|
||||
---
|
||||
|
||||
<vis-graph
|
||||
data-nodes={JSON.stringify(nodes)}
|
||||
data-edges={JSON.stringify(edges)}
|
||||
data-options={JSON.stringify(options)}
|
||||
>
|
||||
<div></div>
|
||||
</vis-graph>
|
||||
@ -59,8 +57,7 @@ const { nodes, edges, options = {} } = Astro.props;
|
||||
levelSeparation: 80
|
||||
}
|
||||
},
|
||||
physics: false,
|
||||
...(JSON.parse(this.dataset.options as string) as Options)
|
||||
physics: false
|
||||
};
|
||||
|
||||
new Network(container, data, options);
|
||||
|
@ -100,9 +100,15 @@ if (paramsNotEqual) {
|
||||
</p>
|
||||
{
|
||||
nodes.length > 0 && (
|
||||
<div id="graph-container">
|
||||
<Graph nodes={nodes} edges={edges} />
|
||||
</div>
|
||||
<>
|
||||
<div id="graph-container">
|
||||
<Graph nodes={nodes} edges={edges} />
|
||||
</div>
|
||||
<small>
|
||||
Drag to pan, scroll to zoom. Click on a node to highlight it and its
|
||||
links.
|
||||
</small>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -110,5 +116,6 @@ if (paramsNotEqual) {
|
||||
#graph-container {
|
||||
height: 600px;
|
||||
border: 1px solid gray;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user