Skip to content

Commit

Permalink
feat: add demo for ERGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Dec 29, 2019
1 parent 1121262 commit 754ce48
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/x6-er/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ package-lock.json
# yarn-lock
yarn.lock

dist

# ignore dist files
.vscode/
Expand Down
49 changes: 40 additions & 9 deletions packages/x6-er/examples/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,49 @@
import React from 'react';
import styles from './index.css';
import ERGraph from '../../../dist/index';

const data = {
nodes: [
{
id: 'node-0',
x: 40,
y: 40,
width: 300,
height: 200,
render: () => {
return <div>hello node-0</div>;
},
},
{
id: 'node-1',
x: 140,
y: 40,
width: 300,
height: 200,
render: () => {
return (
<div
onClick={() => {
console.log('node-1');
}}
>
hello node-1
</div>
);
},
},
],
edges: [
{
source: 'node-0',
target: 'node-1',
},
],
};
export default function() {
return (
<div className={styles.normal}>
<div className={styles.welcome} />
<ul className={styles.list}>
<li>
To get started, edit <code>src/pages/index.js</code> and save to reload.
</li>
<li>
<a href="https://umijs.org/guide/getting-started.html">Getting Started</a>
</li>
</ul>
<ERGraph data={data} />
</div>
);
}
7 changes: 7 additions & 0 deletions packages/x6-er/src/components/Node.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react'

const Node = () => {
return <div>hello Node</div>
}

export default Node
Empty file.

0 comments on commit 754ce48

Please sign in to comment.