I'm trying to use reactstrap to display 2 differents modals onClick in my footer component.
I managed to build a class based footer who toggle the modal visibility based on the state and an external modal element to display the modal when clicking on each 'link'.
But i'm still trying to figure out a way to display a different content (title and modal body) on the same modal for each link.
//FOOTER
import React, { Component } from 'react';
import MainModal from '../../elements/modal';
class Footer extends Component{
state = {
modal: false
}
toggle = () => {
this.setState({
modal: !this.state.modal
})
}
render(){
return(
<footer className="container-fluid footer">
<div className="modals sm-text-center">
<span className="sm-block"><span className="fLink" onClick={this.toggle}>Terms of use</span> | <span className="fLink" onClick={this.toggle}>Privacy Policy</span></span>
<div className="clearfix"/>
</div>
<MainModal type="basic" toggle={this.toggle} modal={this.state.modal}/>
</footer>
)
}
}
export default Footer;
//MODAL TEMPLATE
import React, { Component } from 'react';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
class MainModal extends Component {
render(){
return(
<Modal isOpen={this.props.modal} toggle={this.props.toggle}>
<ModalHeader toggle={this.props.toggle}>Modal title</ModalHeader>
<ModalBody>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</ModalBody>
</Modal>
);
}
};
export default MainModal;
What would be the best/elegant way to display the content content for the Terms of use and the privacy policy?