Commit da6348b3 authored by 张媛's avatar 张媛

组件概览完善

parent 6a2de5f4
...@@ -52,7 +52,7 @@ export const parameters = { ...@@ -52,7 +52,7 @@ export const parameters = {
viewport: { viewports: customViewports }, viewport: { viewports: customViewports },
options: { options: {
storySort: { storySort: {
order: ["Introduction","Canvas组件概览","React组件概览","Canvas组件","React组件"], order: ["Introduction","组件概览","React组件概览","Canvas组件","React组件"],
}, },
}, },
}; };
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -15,8 +15,13 @@ interface TestProps { ...@@ -15,8 +15,13 @@ interface TestProps {
num:number; num:number;
/** 缓动系数,系数越大移动越快。在0-1之间*/ /** 缓动系数,系数越大移动越快。在0-1之间*/
k:number; k:number;
/**轮播组件的x坐标 */
x:number;
/**轮播组件的y坐标 */
y:number;
/**轮播的数据 */ /**轮播的数据 */
data:any; data:any;
} }
export const CarouselCom = (pros:TestProps)=>{ export const CarouselCom = (pros:TestProps)=>{
...@@ -25,6 +30,7 @@ export const CarouselCom = (pros:TestProps)=>{ ...@@ -25,6 +30,7 @@ export const CarouselCom = (pros:TestProps)=>{
window.stage.removeAllChildren(); window.stage.removeAllChildren();
const {carouselItem,itemWidth,itemHeight,vertical,num,k} = pros const {carouselItem,itemWidth,itemHeight,vertical,num,k} = pros
const carouseCom = new CarouselComponent(carouselItem, itemWidth, itemHeight,vertical, num, k); const carouseCom = new CarouselComponent(carouselItem, itemWidth, itemHeight,vertical, num, k);
carouseCom.position.set(pros.x,pros.y)
window.stage.addChild(carouseCom); window.stage.addChild(carouseCom);
carouseCom.updateData(pros.data); carouseCom.updateData(pros.data);
}) })
......
...@@ -66,6 +66,8 @@ Demo1.args = { ...@@ -66,6 +66,8 @@ Demo1.args = {
vertical:false, vertical:false,
num:3, num:3,
k:0.3, k:0.3,
x:100,
y:100,
data:[ data:[
{ {
"rule": "ru_1", "rule": "ru_1",
......
import React from 'react';
import {TotalCom} from "./totalCanvasCom";
import {
Title,
Subtitle,
Description,
ArgsTable,
PRIMARY_STORY,
} from '@storybook/addon-docs';
export default {
component: TotalCom,
title: 'Canvas组件概览',
};
const Template = () => <TotalCom />;
export const CanvasPreview = Template.bind({});
\ No newline at end of file
import React from 'react'; import React from 'react';
import {TotalCom} from "./totalReactCom"; import {TotalCom} from "./totalCom";
import { import {
Title, Title,
Subtitle, Subtitle,
...@@ -9,7 +9,11 @@ import { ...@@ -9,7 +9,11 @@ import {
} from '@storybook/addon-docs'; } from '@storybook/addon-docs';
export default { export default {
component: TotalCom, component: TotalCom,
title: 'React组件概览', title: '组件概览',
parameters:{
layout:"left"
}
}; };
const Template = () => <TotalCom />; const Template = () => <TotalCom />;
export const CanvasPreview = Template.bind({}); export const componentsPreview = Template.bind({});
\ No newline at end of file
.container-div{
width: 750px;
height: 1624px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: flex-start;
align-content: flex-start;
}
.itemCom{
width: 250px;
height: 200px;
}
span{
display: block;
color: #ffffff;
}
*{color: #ffffff;}
\ No newline at end of file
.total-container{
margin: 50px;
}
.container-div{ .container-div{
width: 750px;
height: 1624px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
align-items: flex-start; align-items: flex-start;
align-content: flex-start; align-content: flex-start;
} }
.itemCom{ .itemCom{
width: 250px; width: 250px;
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
} }
span{ span{
display: block; display: block;
width: 200px;
text-align: center;
color: #ffffff; color: #ffffff;
&:hover{
color: cyan;
cursor: pointer;
}
} }
*{color: #ffffff;} *{color: #ffffff;}
\ No newline at end of file
...@@ -2,45 +2,68 @@ import React from 'react'; ...@@ -2,45 +2,68 @@ import React from 'react';
import {clearStage} from "../common/createStage" import {clearStage} from "../common/createStage"
import { useEffect } from 'react'; import { useEffect } from 'react';
import {navigate,LinkTo, linkTo,hrefTo } from '@storybook/addon-links'; import {navigate,LinkTo, linkTo,hrefTo } from '@storybook/addon-links';
import "./totalCanvasCom.css" import "./totalCom.less"
const clickFun = (name)=>{ const canvasClickFun = (name)=>{
linkTo('Canvas组件/'+name)(); linkTo('Canvas组件/'+name)();
} }
const reactClickFun = (name)=>{
linkTo('React组件/'+name)();
}
const comArrData = [ const comArrData = [
{ {
name:"金币动效", name:"金币动效",
imgUrl:"/resource/test.gif", imgUrl:"/resource/金币动效.gif",
href:"金币动效" href:"金币动效"
}, },
{ {
name:"轮播组件", name:"轮播组件",
imgUrl:"/resource/test.gif", imgUrl:"/resource/轮播.gif",
href:"轮播组件" href:"轮播组件"
}, },
{ {
name:"多边形坐标系统", name:"多边形坐标系统",
imgUrl:"/resource/test.gif", imgUrl:"/resource/多边形坐标系统.gif",
href:"多边形坐标系统" href:"多边形坐标系统"
}, },
{ {
name:"丰富文本", name:"丰富文本",
imgUrl:"/resource/test.gif", imgUrl:"/resource/丰富文本.gif",
href:"丰富文本" href:"丰富文本"
}, }
]
const reactArrData = [
{
name:"弹幕",
imgUrl:"/resource/reactDanmu.gif",
href:"弹幕"
}
] ]
export const TotalCom = ()=>{ export const TotalCom = ()=>{
clearStage(); clearStage();
return ( return (
<div > <div className="total-container">
<h2>canvas组件概览</h2> <h2>canvas组件概览</h2>
<div className ="container-div"> <div className ="container-div">
{ {
comArrData.map((el,index)=>{ comArrData.map((el,index)=>{
return ( return (
<div className="itemCom"> <div key={index} className="itemCom">
<img src={el.imgUrl} width = "200" height = "150"/>
<span onClick = {canvasClickFun.bind(this,el.name)} >{el.name}</span>
</div>
)
})
}
</div>
<h2>React组件概览</h2>
<div className ="container-div">
{
reactArrData.map((el,index)=>{
return (
<div key={index} className="itemCom">
<img src={el.imgUrl} width = "200" height = "150"/> <img src={el.imgUrl} width = "200" height = "150"/>
<span onClick = {clickFun.bind(this,el.name)} >{el.name}</span> <span onClick = {reactClickFun.bind(this,el.name)} >{el.name}</span>
</div> </div>
) )
}) })
......
import React from 'react';
import {clearStage} from "../common/createStage"
import { useEffect } from 'react';
import {navigate,LinkTo, linkTo,hrefTo } from '@storybook/addon-links';
import "./totalCanvasCom.css"
const clickFun = (name)=>{
linkTo('React组件/'+name)();
}
const comArrData = [
{
name:"弹幕",
imgUrl:"/resource/test.gif",
href:"弹幕"
}
]
export const TotalCom = ()=>{
clearStage();
return (
<div >
<h2>canvas组件概览</h2>
<div className ="container-div">
{
comArrData.map((el,index)=>{
return (
<div className="itemCom">
<img src={el.imgUrl} width = "200" height = "150"/>
<span onClick = {clickFun.bind(this,el.name)} >{el.name}</span>
</div>
)
})
}
</div>
</div>
)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment