refactor node context menu III, added zustand
This commit is contained in:
12
src/App.tsx
12
src/App.tsx
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { createContext, useState } from 'react';
|
||||
import { Layout, theme, Breadcrumb } from 'antd';
|
||||
import Graph, { NodeModel } from './components/Graph';
|
||||
import Graph, { GraphModel } from './components/Graph';
|
||||
import type { BreadcrumbItemType } from 'antd/es/breadcrumb/Breadcrumb';
|
||||
|
||||
const { Content } = Layout;
|
||||
@@ -11,14 +11,10 @@ const App: React.FC = () => {
|
||||
} = theme.useToken();
|
||||
const [graphLevel, setGraphLevel] = useState<BreadcrumbItemType[]>([])
|
||||
|
||||
function setGraphLevelPath(path: BreadcrumbItemType[]) {
|
||||
setGraphLevel(path)
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Layout>
|
||||
<Breadcrumb style={{ margin: '8px 0 0 16px' }} items={graphLevel} />
|
||||
<Breadcrumb style={{ margin: '8px 0 0 16px' }} items={graphLevel} />
|
||||
<Content
|
||||
style={{
|
||||
margin: '8px 16px',
|
||||
@@ -28,7 +24,7 @@ const App: React.FC = () => {
|
||||
borderRadius: borderRadiusLG,
|
||||
}}
|
||||
>
|
||||
<Graph setGraphPath={setGraphLevelPath} />
|
||||
<Graph setGraphPath={setGraphLevel} />
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user