bee-table/demo/index-demo-base.js

86 lines
2.3 KiB
JavaScript
Raw Normal View History

2016-12-26 16:52:39 +08:00
import { Con, Row, Col } from 'bee-layout';
import { Panel } from 'bee-panel';
import Button from 'bee-button';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Table from '../src';
2016-12-26 22:04:16 +08:00
import Animate from 'bee-animate';
2017-08-30 11:18:38 +08:00
import Pagination from "bee-pagination";
2017-01-11 17:01:50 +08:00
import Icon from "bee-icon";
2017-09-08 10:50:29 +08:00
import Checkbox from "bee-checkbox";
2017-08-30 11:18:38 +08:00
import InputGroup from 'bee-input-group';
import FormControl from 'bee-form-control';
2017-01-11 17:01:50 +08:00
import Input from 'bee-form-control';
import Popconfirm from 'bee-popconfirm';
2016-12-26 16:52:39 +08:00
2017-01-11 17:01:50 +08:00
const CARET = <i className="uf uf-arrow-down"></i>;
2016-12-26 16:52:39 +08:00
2017-01-11 17:01:50 +08:00
const CARETUP = <i className="uf uf-arrow-up"></i>;
2016-12-26 16:52:39 +08:00
{demolist}
class Demo extends Component {
constructor(props){
super(props);
this.state = {
open: false
}
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.setState({ open: !this.state.open })
}
render () {
const { title, example, code, desc } = this.props;
let caret = this.state.open ? CARETUP : CARET;
let text = this.state.open ? "隐藏代码" : "查看代码";
const footer = (
<Button shape="block" onClick={ this.handleClick }>
{ caret }
{ text }
</Button>
);
const header = (
<Row>
2017-01-11 17:01:50 +08:00
<Col md={12}>
2016-12-26 16:52:39 +08:00
{ example }
</Col>
</Row>
);
return (
<Col md={12} >
<h3>{ title }</h3>
<p>{ desc }</p>
<Panel collapsible headerContent expanded={ this.state.open } colors='bordered' header={ header } footer={footer} footerStyle = {{padding: 0}}>
<pre><code className="hljs javascript">{ code }</code></pre>
</Panel>
</Col>
)
}
}
class DemoGroup extends Component {
constructor(props){
super(props)
}
render () {
return (
<Row>
{DemoArray.map((child,index) => {
return (
<Demo example= {child.example} title= {child.title} code= {child.code} desc= {child.desc} key= {index}/>
)
})}
</Row>
)
}
}
ReactDOM.render(<DemoGroup/>, document.getElementById('tinperBeeDemo'));