Component refactoring
This commit is contained in:
28
src/components/UI/Text/Text.js
Normal file
28
src/components/UI/Text/Text.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from 'react';
|
||||
import CSSModules from 'react-css-modules';
|
||||
import styles from './Text.css';
|
||||
|
||||
export default CSSModules((props) => {
|
||||
const styleList = [];
|
||||
styleList.push('Text');
|
||||
if (props.type) {
|
||||
styleList.push(props.type);
|
||||
}
|
||||
|
||||
let style = {...props.style};
|
||||
if (props.textAlign) {
|
||||
style['textAlign'] = props.textAlign.toLowerCase();
|
||||
}
|
||||
|
||||
const text = (
|
||||
<div
|
||||
styleName={styleList.join(' ')}
|
||||
style={style}>{props.text}
|
||||
</div>);
|
||||
|
||||
return props.noOwner ? text : (
|
||||
<div styleName={'TextOwner'}>
|
||||
{text}
|
||||
</div>);
|
||||
|
||||
}, styles, {allowMultiple: true});
|
||||
Reference in New Issue
Block a user