I am trying to have a center div background color transition each time the "New Quote" button is clicked and a new quote generated. I am having trouble 1. with setting the transition to this div. I would like to have a set of 5 colors that the div will transition to in order. Can this be an array of css colors? Not sure how to go about this. I am also not sure how to link this transition to the button click event.
Button Component:
class Button extends React.Component {
constructor(props) {
super(props);
this.state = {
showComponent: true,
cardColor: true,
backgroundColor: true
};
this.onButtonClick = this.onButtonClick.bind(this);
}
onButtonClick() {
this.setState({
showComponent: true,
cardColor: true,
backgroundColor: true
});
}
render(){
return(
<div>
<button onClick={this.onButtonClick} type='button' class='btn btn-primary'
style={{
position: 'absolute',
right: '10px',
bottom: '10px',
padding: '2%'
}}>New Quote</button>
{this.state.showComponent ? <AuthorQuotePrint props={QUOTES}/> : null}
</div>
)
}
}
Quote Box Div:
class RandomQuoteBox extends React.Component{
render(){
const myStyle={
backgroundColor: 'red',
width: '500px',
height: '300px',
margin: '0 auto'
};
return(
<div class="container">
<div class="row">
<div class="col">
</div>
<div class="col-8">
<div class="card" style={myStyle}>
<div>
<Button />
</div>
</div>
</div>
<div class="col">
</div>
</div>
</div>
);
}
}