From de6bc06da435c81b004568b7c34f8ddd96ce53d2 Mon Sep 17 00:00:00 2001 From: Zxilly Date: Mon, 22 Jul 2024 15:36:52 +0800 Subject: [PATCH] chore: use const for padding Signed-off-by: Zxilly --- ui/src/TreeMap.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/src/TreeMap.tsx b/ui/src/TreeMap.tsx index ee3cdf31d0..b58b36ff29 100644 --- a/ui/src/TreeMap.tsx +++ b/ui/src/TreeMap.tsx @@ -3,15 +3,14 @@ import { group } from "d3-array"; import type { HierarchyNode } from "d3-hierarchy"; import { hierarchy, treemap, treemapSquarify } from "d3-hierarchy"; import { useTitle, useWindowSize } from "react-use"; - import type { Entry } from "./tool/entry.ts"; import createRainbowColor from "./tool/color.ts"; import { Tooltip } from "./Tooltip.tsx"; import { Node } from "./Node.tsx"; - import "./style.scss"; import { trimPrefix } from "./tool/utils.ts"; import { shallowCopy } from "./tool/copy.ts"; +import { PADDING, TOP_PADDING } from "./tool/const.ts"; interface TreeMapProps { entry: Entry; @@ -56,8 +55,8 @@ function TreeMap({ entry }: TreeMapProps) { const layout = useMemo(() => { return treemap() .size([width, height]) - .paddingInner(1) - .paddingTop(20) + .paddingInner(PADDING) + .paddingTop(TOP_PADDING) .round(true) .tile(treemapSquarify); }, [height, width]);