mirror of
https://gitee.com/antv/g6.git
synced 2024-12-03 04:08:32 +08:00
feat: storybook supports g6 demo
This commit is contained in:
parent
ceba71f5e3
commit
c6dc7b1c65
@ -1,5 +1,7 @@
|
||||
module.exports = ({ config }) => {
|
||||
const resolve = require('path').resolve;
|
||||
|
||||
module.exports = ({ config }) => {
|
||||
|
||||
config.module.rules.push({
|
||||
test: /\.(ts|tsx)$/,
|
||||
loader: require.resolve('awesome-typescript-loader'),
|
||||
@ -34,5 +36,10 @@ module.exports = ({ config }) => {
|
||||
|
||||
config.resolve.extensions.push('.ts', '.tsx', '.js');
|
||||
|
||||
config.resolve.alias = {
|
||||
'@g6/types': resolve(process.cwd(), './types'),
|
||||
'@g6': resolve(process.cwd(), './src')
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ const DefaultShape = () => {
|
||||
useEffect(() => {
|
||||
if(!graph) {
|
||||
graph = new G6.Graph({
|
||||
container,
|
||||
container: container.current as string | HTMLElement,
|
||||
width: 500,
|
||||
height: 500
|
||||
})
|
||||
|
@ -2,15 +2,15 @@
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { Button } from '@storybook/react/demo'; // 这里引入你想展示的组件
|
||||
import React from 'react';
|
||||
// import DefaultShape from './component/default-shape'
|
||||
import DefaultShape from './component/default-shape'
|
||||
|
||||
export default { title: 'Shape' };
|
||||
|
||||
|
||||
storiesOf('Shape', module)
|
||||
// .add('with', () => ( // 一个 add 表示添加一个 story
|
||||
// <DefaultShape />
|
||||
// ))
|
||||
.add('with', () => ( // 一个 add 表示添加一个 story
|
||||
<DefaultShape />
|
||||
))
|
||||
.add('with some emoji', () => ( // 这里是另一个 story
|
||||
<span><span role="img" aria-label="so cool">😀 😎 👍 💯</span></span>
|
||||
));
|
Loading…
Reference in New Issue
Block a user