1.1.1 • Published 7 years ago

react-introjs v1.1.1

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

#react-introjs

A small React wrapper for Intro.js. Currently it only supports steps.

Installation

npm install --save react-introjs

Don't forget install react and introjs as they are peer dependencies.

Usage

Using InrojsProvider to wrap your application. code example:

import { Provider } from 'react-redux';
import React from 'react';
import { render } from 'react-dom';
import { IntrojsProvider } from 'react-introjs';
import App from './components/App';
import store from './configureStore';

render(
  <IntrojsProvider
    onExit={() => console.log('exit')}
    onConfigureIntroJs={() => new Promise((resolve, reject) => {
      resolve([
        {
          element: '[introjs-step-id="step1"]',
          intro: 'test 1',
          position: 'right',
          tooltipClass: 'myTooltipClass',
          highlightClass: 'myHighlightClass',
        },
        {
          element: '[introjs-step-id="step2"]',
          intro: 'test 2',
        },
      ]);
    })}
  >
    <Provider store={store} >
      <App />
    </Provider>
  </IntrojsProvider>, document.getElementById('main'));

then using connectIntrojsStep to wrap the steps and connectIntrojsControl to get controls of Introjs method. code example:

import React from 'react';
import { Input } from 'semantic-ui-react';
import { connectIntrojsStep, connectIntrojsControl } from 'react-introjs';
import styles from './App.css';

const IntrojsStartButton = connectIntrojsControl((props) => {
  const { introjsStart, introjsIsConfigured } = props;
  return <button onClick={() => {
    if(introjsIsConfigured()) introjsStart()
  }} >introjs start</button>;
});

const App = (props) => {
  const IntrojsConnectedAtag = connectIntrojsStep('a', 'step1');
  const IntrojsConnectedInput = connectIntrojsStep(Input, 'step2');
  return (
    <div className={styles.container} >
      <IntrojsStartButton />
      <IntrojsConnectedAtag >test1</IntrojsConnectedAtag>

      <IntrojsConnectedInput
        placeholder="Search on title..." onChange={() => console.log('search')}
        className={styles.searchInput} />
    </div>
  );
};
export default App;
1.1.1

7 years ago

1.1.0

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago