
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
react-maxwell-modal
Advanced tools
React-Maxwell-Modal Github Page
npm install react-maxwell-modal --save
There are four types of modals available
Prop | Type | Required |
---|---|---|
onShow | function | false |
onHide | function | true |
isOpen | bool | false |
shouldCloseOnOverlayClick | bool | false |
import { ContentModal } from 'react-maxwell-modal';
class ContentModalExample extends React.Component {
constructor(props) {
super(props);
this.state = {
isOpen: false
}
this.displayName = 'ContentModalExample';
this.toggleModal = this.toggleModal.bind(this);
}
toggleModal() {
this.setState({
isOpen: !this.state.isOpen
})
}
render() {
return (
<div className="ClickMeMaxwellModal">
<button onClick={this.toggleModal}>Load Modal</button>
<ContentModal
ref="mymodal"
isOpen={this.state.isOpen}
shouldCloseOnOverlayClick={true}
onHide={this.toggleModal}
>
<span>A bunch of useless stuff</span>
</ContentModal>
</div>
);
}
}
Prop | Type | Required |
---|---|---|
footer | ReactComponent/String | false |
onShow | function | false |
onHide | function | true |
title | string | false |
isOpen | bool | false |
dismissable | bool | false |
shouldCloseOnOverlayClick | bool | false |
import { MaxwellModal } from 'react-maxwell-modal';
class MaxwellModalExample extends React.Component {
constructor(props) {
super(props);
this.state = {
isOpen: false
}
this.displayName = 'MaxwellModalExample';
this.toggleModal = this.toggleModal.bind(this);
}
toggleModal() {
this.setState({
isOpen: !this.state.isOpen
})
}
render() {
return (
<div className="ClickMeMaxwellModal">
<button onClick={this.toggleModal}>Load Modal</button>
<MaxwellModal
ref="mymodal"
isOpen={this.state.isOpen}
title={"this is a title"}
shouldCloseOnOverlayClick={true}
onHide={this.toggleModal}
>
<span>A bunch of useless stuff</span>
</MaxwellModal>
</div>
);
}
}
A replacement for the confirm box.
This produces a modal with two buttons, yes
and no
. Their labels are configurable, as well as what occurs on yes
and no
.
####Props
Prop | Type | Required |
---|---|---|
onYes | function | false |
onNo | function | false |
yesLabel | string | false |
noLabel | string | false |
onShow | function | false |
onHide | function | true |
title | string | false |
isOpen | bool | false |
dismissable | bool | false |
shouldCloseOnOverlayClick | bool | false |
import { ConfirmModal } from 'react-maxwell-modal';
class ConfirmModalExample extends React.Component {
constructor(props) {
super(props);
this.state = {
isOpen: false
}
this.displayName = 'ConfirmModalExample';
this.toggleModal = this.toggleModal.bind(this);
this.onYes = this.onYes.bind(this);
this.onNo = this.onNo.bind(this);
}
onYes(closeModal) {
closeModal(true)
}
onNo(closeModal) {
closeModal(true)
}
toggleModal() {
this.setState({
isOpen: !this.state.isOpen
})
}
render() {
return (
<div className="ClickMeMaxwellModal">
<button onClick={this.toggleModal}>Load Modal</button>
<ConfirmModal
ref="mymodal"
isOpen={this.state.isOpen}
shouldCloseOnOverlayClick={true}
onHide={this.toggleModal}
onYes={this.onYes}
onNo={this.onNo}
>
<span>A bunch of useless stuff</span>
</ConfirmModal>
</div>
);
}
}
A replacement for the alert box
Prop | Type | Required |
---|---|---|
onYes | function | false |
yesLabel | string | false |
onShow | function | false |
onHide | function | true |
title | string | false |
isOpen | bool | false |
dismissable | bool | false |
shouldCloseOnOverlayClick | bool | false |
import { AlertModal } from 'react-maxwell-modal';
class AlertModalExample extends React.Component {
constructor(props) {
super(props);
this.state = {
isOpen: false
}
this.displayName = 'AlertModalExample';
this.toggleModal = this.toggleModal.bind(this);
this.onYes = this.onYes.bind(this);
}
onYes(closeModal) {
closeModal(true)
}
toggleModal() {
this.setState({
isOpen: !this.state.isOpen
})
}
render() {
return (
<div className="ClickMeMaxwellModal">
<button onClick={this.toggleModal}>Load Modal</button>
<AlertModal
ref="mymodal"
isOpen={this.state.isOpen}
shouldCloseOnOverlayClick={true}
onHide={this.toggleModal}
onYes={this.onYes}
>
<span>A bunch of useless stuff</span>
</AlertModal>
</div>
);
}
}
FAQs
A react component for awesome modals
We found that react-maxwell-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.