
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
modal-popup
Advanced tools
npm install --save https://github.com/raff-r/redux-modal.git
reducer
to Redux.import { combineReducers } from 'redux';
import modalReducer from 'modal-popup';
const rootReducer = combineReducers({
modals: modalReducer
});
export default rootReducer;
redux-modal
must be modals
.Modal
component and styles to the root of your app.import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from "redux";
import {
modal as Modal,
styles
} from 'modal-popup';
import reducers from './reducers';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
reducers,
composeEnhancers(applyMiddleware())
);
ReactDOM.render(
<Provider store={store}>
<div>
... other JSX ...
<ReduxModal />
</div>
</Provider>
, document.querySelector('#root'));
import React, { Component } from 'react';
import {connect} from 'react-redux';
import {actions} from 'modal-popup';
const DemoModal = () => {
return (
<div>
This is a test modal
</div>
)
};
class AppTest extends Component {
constructor(props) {
super(props);
this.openModal = this.openModal.bind(this);
}
openModal(e, options) {
e.preventDefault();
this.props.showModal(DemoModal, options);
}
render() {
return (
<div className="container">
<br/><br/>
<div className="row center-align">
<div className="col s3">
<a className="waves-effect waves-light btn" onClick={(e) => this.openModal(e, {size: 'small'})}>Small</a>
</div>
<div className="col s3">
<a className="waves-effect waves-light btn" onClick={(e) => this.openModal(e, {size: 'medium'})}>Medium</a>
</div>
<div className="col s3">
<a className="waves-effect waves-light btn" onClick={(e) => this.openModal(e, {size: 'large'})}>Large</a>
</div>
<div className="col s3">
<a className="waves-effect waves-light btn" onClick={(e) => this.openModal(e, {size: 'full-screen'})}>Full Screen</a>
</div>
</div>
</div>
);
}
}
export default connect(null,actions)(AppTest);
Display a modal popup with a specific React component and options
The react component to render inside of the modal popup
The properties to adjust the behaviour of the modal popup
Property | Description | Values |
---|---|---|
size | Adjust the width of the modal popup | small, medium, large, full-screen |
Remove the current open modal from the DOM
FAQs
A react-redux modal popup
The npm package modal-popup receives a total of 1 weekly downloads. As such, modal-popup popularity was classified as not popular.
We found that modal-popup 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 Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.