refactoring card

This commit is contained in:
frab1t 2019-05-10 14:39:30 +02:00
parent de5a2e168f
commit dc447c023e
1 changed files with 13 additions and 6 deletions

View File

@ -15,18 +15,26 @@ class Card extends Component {
}
render() {
let textAlign = "";
let bodyAlign;
let headAlign;
if (this.props.align) {
textAlign = `text-${this.props.align}`;
bodyAlign = `text-${this.props.bodyAlign}`;
}
if (this.props.headAlign) {
headAlign = `text-${this.props.headAlign}`;
}
return (
<div>
<CardBootstrap className={`${textAlign} shadow-sm p-3 mb-5 bg-white rounded`} >
<CardBootstrap
className={`${bodyAlign} shadow-sm p-3 mb-5 bg-white rounded`}
>
<CardBody>
<CardTitle>
<h4>{this.props.title}</h4>
<h4 className={headAlign}>
{this.props.title}
</h4>
</CardTitle>
<CardText>
{this.props.subtitle}
@ -36,7 +44,6 @@ class Card extends Component {
</div>
</CardBody>
</CardBootstrap>
</div>
);
}
}