|
| 1 | +import _ from 'lodash'; |
1 | 2 | import React, {Component, PropTypes} from 'react'; |
2 | 3 | import classNames from 'classnames'; |
3 | 4 | import META from 'src/utils/Meta'; |
4 | 5 |
|
5 | | -// export default class Button extends Component { |
6 | | -// static propTypes = { |
7 | | -// children: PropTypes.node, |
8 | | -// className: PropTypes.string, |
9 | | -// }; |
| 6 | +export default class Divider extends Component { |
| 7 | + static propTypes = { |
| 8 | + children: PropTypes.node, |
| 9 | + className: PropTypes.string, |
| 10 | + header: PropTypes.string, |
| 11 | + }; |
10 | 12 |
|
11 | | -// static defaultProps = { |
12 | | -// children: 'Click Here', |
13 | | -// type: 'button' |
14 | | -// };s |
| 13 | + static _meta = { |
| 14 | + library: META.library.semanticUI, |
| 15 | + name: 'Divider', |
| 16 | + type: META.type.element, |
| 17 | + }; |
15 | 18 |
|
16 | | -// static _meta = { |
17 | | -// library: META.library.semanticUI, |
18 | | -// name: 'Button', |
19 | | -// type: META.type.element, |
20 | | -// }; |
21 | | - |
22 | | -// render() { |
23 | | -// const classes = classNames( |
24 | | -// 'sd-button', |
25 | | -// 'ui', |
26 | | -// this.props.className, |
27 | | -// 'button' |
28 | | -// ); |
29 | | -// return ( |
30 | | -// <button {...this.props} className={classes}> |
31 | | -// {this.props.children} |
32 | | -// </button> |
33 | | -// ); |
34 | | -// } |
35 | | -// } |
| 19 | + render() { |
| 20 | + const children = _.clone(this.props.children); |
| 21 | + const header = <div className='header'>{this.props.header}</div>; |
| 22 | + const classes = classNames( |
| 23 | + 'sd-button', |
| 24 | + 'ui', |
| 25 | + this.props.className, |
| 26 | + 'divider' |
| 27 | + ); |
| 28 | + return ( |
| 29 | + <div {...this.props} className={classes}> |
| 30 | + <div className='divider'> |
| 31 | + {children | header} |
| 32 | + </div> |
| 33 | + </div> |
| 34 | + ); |
| 35 | + } |
| 36 | +} |
0 commit comments