Jacky Zhao
2024-03-18 daa8796554dea41d6fbf81f4eccea58153a4e850
quartz/components/Graph.tsx
@@ -1,4 +1,4 @@
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
// @ts-ignore
import script from "./scripts/graph.inline"
import style from "./styles/graph.scss"
@@ -17,6 +17,7 @@
  opacityScale: number
  removeTags: string[]
  showTags: boolean
  focusOnHover?: boolean
}
interface GraphOptions {
@@ -37,6 +38,7 @@
    opacityScale: 1,
    showTags: true,
    removeTags: [],
    focusOnHover: false,
  },
  globalGraph: {
    drag: true,
@@ -50,11 +52,12 @@
    opacityScale: 1,
    showTags: true,
    removeTags: [],
    focusOnHover: true,
  },
}
export default ((opts?: GraphOptions) => {
  function Graph({ displayClass, cfg }: QuartzComponentProps) {
  const Graph: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
    const localGraph = { ...defaultOptions.localGraph, ...opts?.localGraph }
    const globalGraph = { ...defaultOptions.globalGraph, ...opts?.globalGraph }
    return (