28 lines
609 B
JavaScript
28 lines
609 B
JavaScript
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}); |