From 9acaa1c8ac8c8afd3fa08d3b1f58a60006fcfc6f Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 09 Aug 2024 01:19:45 +0000
Subject: [PATCH] feat: custom global latex macros (closes #1325)

---
 quartz/components/Graph.tsx |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/quartz/components/Graph.tsx b/quartz/components/Graph.tsx
index 0c54bdb..f7ebcc9 100644
--- a/quartz/components/Graph.tsx
+++ b/quartz/components/Graph.tsx
@@ -1,7 +1,9 @@
-import { QuartzComponentConstructor } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
 // @ts-ignore
 import script from "./scripts/graph.inline"
 import style from "./styles/graph.scss"
+import { i18n } from "../i18n"
+import { classNames } from "../util/lang"
 
 export interface D3Config {
   drag: boolean
@@ -13,6 +15,9 @@
   linkDistance: number
   fontSize: number
   opacityScale: number
+  removeTags: string[]
+  showTags: boolean
+  focusOnHover?: boolean
 }
 
 interface GraphOptions {
@@ -31,6 +36,9 @@
     linkDistance: 30,
     fontSize: 0.6,
     opacityScale: 1,
+    showTags: true,
+    removeTags: [],
+    focusOnHover: false,
   },
   globalGraph: {
     drag: true,
@@ -42,16 +50,19 @@
     linkDistance: 30,
     fontSize: 0.6,
     opacityScale: 1,
+    showTags: true,
+    removeTags: [],
+    focusOnHover: true,
   },
 }
 
 export default ((opts?: GraphOptions) => {
-  function Graph() {
-    const localGraph = { ...defaultOptions.localGraph, ...opts?.localGraph, }
-    const globalGraph = { ...defaultOptions.globalGraph, ...opts?.globalGraph, }
+  const Graph: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
+    const localGraph = { ...defaultOptions.localGraph, ...opts?.localGraph }
+    const globalGraph = { ...defaultOptions.globalGraph, ...opts?.globalGraph }
     return (
-      <div class="graph">
-        <h3>Graph View</h3>
+      <div class={classNames(displayClass, "graph")}>
+        <h3>{i18n(cfg.locale).components.graph.title}</h3>
         <div class="graph-outer">
           <div id="graph-container" data-cfg={JSON.stringify(localGraph)}></div>
           <svg

--
Gitblit v1.10.0