35 lines
716 B
JavaScript
35 lines
716 B
JavaScript
import './Text.css';
|
|
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
|
|
const Text = (props) => {
|
|
const styleList = [];
|
|
styleList.push('Text');
|
|
if (props.type) {
|
|
styleList.push('Text' + props.type);
|
|
}
|
|
|
|
let style = { ...props.style };
|
|
if (props.textAlign) {
|
|
style['textAlign'] = props.textAlign.toLowerCase();
|
|
}
|
|
|
|
const text = (
|
|
<div className={styleList.join(' ')} style={style}>
|
|
{props.text}
|
|
</div>
|
|
);
|
|
|
|
return props.noOwner ? text : <div className={'TextOwner'}>{text}</div>;
|
|
};
|
|
|
|
Text.propTypes = {
|
|
noOwner: PropTypes.bool,
|
|
style: PropTypes.object,
|
|
text: PropTypes.string,
|
|
textAlign: PropTypes.string,
|
|
type: PropTypes.string,
|
|
};
|
|
|
|
export default Text;
|