2.0.0 • Published 4 years ago

dialog-notification v2.0.0

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

dialog-notification

Getting started

Installation

npm i dialog-notification
yarn add dialog-notification

Basic usage

1. Wrap your App with DialogProvider component.

import { DialogProvider } from 'dialog-notification';

<DialogProvider>
  <App/>
</DialogProvider>

Note: If you are using Material UI ThemeProvider, make sure to wrap your App under it.

2. Use withDialog decorator to access openDialog function.

import { withDialog } from 'dialog-notification';
import { Button } from '@material-ui/core';

class ClassComponent extends Component {
  render() {
    const { openDialog } = this.props;

    return (
      <Button onClick={() => openDialog('Hello! I am dialog window.')}>
        Open dialog
      </Button>
    );
  }
}

export default withDialog(ClassComponent);

2 (alternative). You can also use useDialog hook to call inside function components.

import { useDialog } from 'dialog-notification';
import { Button } from '@material-ui/core';

export default function FuncComponent() {
  const { openDialog } = useDialog();

  return (
    <Button onClick={() => openDialog('Hello! I am dialog window.')}>
      Open dialog
    </Button>
  );
}
1.2.5

4 years ago

2.0.0

4 years ago

1.2.4

4 years ago

1.2.0

5 years ago

1.2.3

5 years ago

1.2.1

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.1

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.28

5 years ago

1.0.26

5 years ago

1.0.27

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.19

5 years ago

1.0.20

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago