Commit 428f0ce1 by 小明

重构 components 下 TextGropu 组件代码

parent abc179c0
/**
*
* IKTextGroup
*
*/
import React, { PureComponent } from 'react';
class IKTextGroup extends PureComponent { // eslint-disable-line react/prefer-stateless-function
static propTypes = {
position: React.PropTypes.string,
title: React.PropTypes.string,
className: React.PropTypes.string,
};
constructor(props) {
super(props);
}
render() {
const props = $({}, this.props);
let className = 'ikmd-text-group-container';
let groupClassName = 'ikmd-text-group';
let titleElm = null;
if (props.title) {
titleElm = (
<div class="ikmd-text-group-header">{props.title}</div>
);
}
if (props.position) {
groupClassName += ` ikmd-text-group-${props.position}`;
}
if (props.className) {
className += ` ${props.className}`;
}
return (
<div className={className}>
{titleElm}
<div className={groupClassName}>
{props.children}
</div>
</div>
);
}
}
export default IKTextGroup;
// import IKTextGroup from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<IKTextGroup />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(false);
});
});
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