All Projects → nghiepit → react-redux-modal-flex

nghiepit / react-redux-modal-flex

Licence: MIT license
[DEPRECATED] Make easy a modal/popup with Redux

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-redux-modal-flex

Nativepopup
Clone of Apple iOS App's feedback popup, and easily customizable.
Stars: ✭ 247 (+1664.29%)
Mutual labels:  alert, modal, dialog, popup
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (+614.29%)
Mutual labels:  alert, modal, dialog, popup
Jbox
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
Stars: ✭ 1,251 (+8835.71%)
Mutual labels:  alert, modal, dialog, popup
Pmalertcontroller
PMAlertController is a great and customizable alert that can substitute UIAlertController
Stars: ✭ 2,397 (+17021.43%)
Mutual labels:  alert, modal, dialog, popup
Popupdialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
Stars: ✭ 3,709 (+26392.86%)
Mutual labels:  alert, modal, dialog, popup
eins-modal
Simple to use modal / alert / dialog / popup. Created with pure JS. No javascript knowledge required! Works on every browser and device! IE9
Stars: ✭ 30 (+114.29%)
Mutual labels:  alert, modal, dialog, popup
Sweetalert
A beautiful replacement for JavaScript's "alert"
Stars: ✭ 21,871 (+156121.43%)
Mutual labels:  alert, modal, dialog, popup
React Native Alert Pro
The Pro Version of React Native Alert (Android & iOS)
Stars: ✭ 69 (+392.86%)
Mutual labels:  alert, modal, dialog, popup
Jquery Confirm
A multipurpose plugin for alert, confirm & dialog, with extended features.
Stars: ✭ 1,776 (+12585.71%)
Mutual labels:  alert, dialog, popup
Alertifyjs
A javascript framework for developing pretty browser dialogs and notifications.
Stars: ✭ 1,922 (+13628.57%)
Mutual labels:  alert, modal, dialog
LSDialogViewController
Custom Dialog for iOS written in Swift
Stars: ✭ 74 (+428.57%)
Mutual labels:  modal, dialog, popup
Jxpopupview
一个轻量级的自定义视图弹出框架
Stars: ✭ 117 (+735.71%)
Mutual labels:  alert, dialog, popup
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (+1142.86%)
Mutual labels:  alert, modal, dialog
react-st-modal
Simple and flexible modal dialog component for React JS
Stars: ✭ 41 (+192.86%)
Mutual labels:  alert, modal, dialog
Alertjs
Dialog Builder allows you to create fully customisable dialogs and popups in Dynamics 365.
Stars: ✭ 80 (+471.43%)
Mutual labels:  alert, dialog, popup
Alerttoast
Create Apple-like alerts & toasts using SwiftUI
Stars: ✭ 151 (+978.57%)
Mutual labels:  alert, dialog, popup
vue-modal
Reusable Modal component, supports own custom HTML, text and classes.
Stars: ✭ 29 (+107.14%)
Mutual labels:  modal, dialog, popup
React Popup
React popup component
Stars: ✭ 198 (+1314.29%)
Mutual labels:  alert, modal, popup
vue-modal
A customizable, stackable, and lightweight modal component for Vue.
Stars: ✭ 96 (+585.71%)
Mutual labels:  modal, dialog, popup
Jalert
jQuery alert/modal/lightbox plugin
Stars: ✭ 73 (+421.43%)
Mutual labels:  alert, modal, popup

[DEPRECATED] REACT-REDUX-MODAL-FLEX

NPM version NPM monthly download

Make easy a modal/popup with Redux.

⚠️ This will work only with React 16.3+ ⚠️

If you're looking for a version for React 16.2 (for individual pages) use 1.x branch branch.

Demo

https://react-redux-modal-flex.netlify.com

Features

  • Responsive
  • Easy custom animation effect by Animate.css

Installation

To install the stable version you can use:

$ yarn add react-redux-modal-flex

Example

Step 1:

rootReducer.js

import { combineReducers } from "redux";
import { reducer as modal } from "react-redux-modal-flex";
import todos from "./todos";

export default combineReducers({
  todos,
  modal: modal({
    classContent: "modal-content",
    animation: "zoomIn",
    duration: 200,
    mask: true,
    /* initial state, see API reference */
  }),
});

Step 2:

App.js

import Modal from "react-redux-modal-flex";

class App extends React.Component {
  render() {
    return (
      <Router>
        <div className="App">
          <Switch>
            <Route path="/" exact component={Home} />
            <Route path="/auth" component={Auth} />
          </Switch>
          <Modal />
        </div>
      </Router>
    );
  }
}

Step 3:

Any Container you want to use

import { connect } from "react-redux";
import { actions as ModalActions } from "react-redux-modal-flex";

class LoginModal extends React.Component {
  render() {
    return (
      <form>
        <div>
          <label>Username</label>
          <input type="text" name="username" />
        </div>
        <div>
          <label>Password</label>
          <input type="password" name="password" />
        </div>
      </form>
    );
  }
}

class Auth extends React.Component {
  render() {
    return (
      <div>
        <h3>Auth</h3>
        <button
          onClick={() =>
            this.props.toggleModal({
              component: LoginModal,
              ok: {
                text: "Login",
                action: () => alert("submit form"),
              },
            })
          }
        >
          Open modal login
        </button>
      </div>
    );
  }
}

export default connect(null, { toggleModal: ModalActions.toggleModal })(Auth);

API

  • initState: you can overwrite default initial state
const initState = {
  classContent: "modal-content",
  animation: "zoomIn",
  duration: 300,
  mask: true,
  closeByMask: true,
  component: ModalDefault,
  title: "This is a title",
  closeBtn: true,
  textCancel: "Cancel",
  ok: {
    text: "OK",
    classOk: "modal-btn-ok",
    disabled: false,
    action: () => console.log("OK clicked"),
  },
};
  • API
import Modal, {
  reducer as modal,
  actions as ModalActions,
} from "react-redux-modal-flex";
const { toggleModal, modifyOkModal } = ModalActions;
  • <Modal /> is component, using in our App.js
  • reducer using in our rootReducer.js you can custom default initial state
export default combineReducers({
  todos,
  modal: modal({
    textCancel: "Close",
    title: "My default title",
  }),
});
  • toggleModal and modifyOkModal is action

Usage

  • Open Modal by action toggleModal(options)
    • options: is object and look like the initState above
    • Example:
...
render() {
  return (
    <button onClick={() => this.props.toggleModal({
      textCancel: 'Hide',
      component: () => <div>content modal</div>,
      title: 'My title',
      ok: {
        text: 'Login',
        action: () => alert('click OK')
      }
    })}>Click me</button>
  );
}
...
  • Close Modal toggleModal(false) or any value excepted object
  • Modify button OK: modifyOkModal(options) usage like toggleModal
    • Example:
onClick={() => this.props.modifyOkModal({
  text: 'Sign up',
  disabled: true
})}
  • Hide Header if the title is null
  • Hide Cancel button if the textCancel is null
  • Hide Ok button if ok: {text: null}
  • Hide Footer if the Cancel and Ok are hidden

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].