1.1.2 • Published 6 years ago

simple-help-modal v1.1.2

Weekly downloads
21
License
-
Repository
-
Last release
6 years ago

Preview

Usage

React Component

import {HelpModal,DEVICE_TYPE} from "simple-help-modal";

<HelpModal
          onRequestClose={() => {
            console.log("request close");
            this.setState({
              on:false
            })
          }}
          deviceType={DEVICE_TYPE.DESKTOP}
          isOpen={this.state.on}
        >
          <img className="content-img" src="./manual.jpg" />
</HelpModal>

Redux usage

Configure Store

import { createStore, combineReducers } from "redux";

import { reducer as help } from "simple-help-modal";

export function configureStore(initialState = {}) {
  return createStore(
    combineReducers({
      help
    }),
    initialState
  );
}

Smart Component

import { HelpModal, DEVICE_TYPE, TOGGLE } from "simple-help-modal";

class App {
  render() {
    return (
      <div>
        <HelpModal
          onRequestClose={this.props.toggleHelp}
          deviceType={DEVICE_TYPE.DESKTOP}
          isOpen={this.props.help}
        >
          <img className="content-img" src="./manual.jpg" />
        </HelpModal>
      </div>
    );
  }
}

function mapDispatchToProps(dispatch) {
  return {
    toggleHelp: () => dispatch({ type: TOGGLE })
  };
}
function mapStateToProps(state) {
  return {
    help: state.help
  };
}
export default connect(
  mapStateToProps,
  mapDispatchToProps
)(App);

Adv:

  1. Support desktop and phone style
1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.7.0

6 years ago