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