From bbce0af92a2b386d529e8906d557afc4ef333198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Sun, 28 Apr 2024 22:36:57 +0200 Subject: [PATCH] Rename VisGraph component to Graph --- .../{VisGraph.astro => Graph.astro} | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) rename src/components/{VisGraph.astro => Graph.astro} (70%) diff --git a/src/components/VisGraph.astro b/src/components/Graph.astro similarity index 70% rename from src/components/VisGraph.astro rename to src/components/Graph.astro index 1c0fafd..aa32f4d 100644 --- a/src/components/VisGraph.astro +++ b/src/components/Graph.astro @@ -1,7 +1,7 @@ --- import type { Node, Edge, Options } from 'vis-network/esnext'; -export interface Props { +interface Props { nodes: Node[]; edges: Edge[]; options?: Options; @@ -40,6 +40,26 @@ const { nodes, edges, options = {} } = Astro.props; edges }; const options: Options = { + nodes: { + shape: 'box', + color: '#2060df', + font: { + color: '#fff' + } + }, + edges: { + arrows: 'to', + color: '#4178e7' + }, + layout: { + hierarchical: { + direction: 'UD', + sortMethod: 'directed', + nodeSpacing: 175, + levelSeparation: 80 + } + }, + physics: false, ...(JSON.parse(this.dataset.options as string) as Options) }; @@ -52,7 +72,7 @@ const { nodes, edges, options = {} } = Astro.props;