Commit a22ead52 by 小明

重构 components 下 Text 组件代码

parent 428f0ce1
/**
*
* IKText
*
*/
import React, { PureComponent } from 'react';
class IKText extends PureComponent { // eslint-disable-line react/prefer-stateless-function
static propTypes = {
label: React.PropTypes.string,
text: React.PropTypes.string,
button: React.PropTypes.string,
buttonEvent: React.PropTypes.func,
};
constructor(props) {
super(props);
}
render() {
const props = $({}, this.props);
let svgElm = null;
if (props.button) {
props.style = { width: '80%' };
svgElm = (
<svg>
<use xlinkHref={props.button} onClick={props.buttonEvent} />
</svg>
);
}
return (
<div className="ikmd-text">
<label className='shrunken'>{props.label}</label>
<span>{props.text}</span>
{svgElm}
</div>
);
}
}
export default IKText;
// import IKText from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<IKText />', () => {
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