bs4-modal-react
Advanced tools
Comparing version 0.0.2 to 0.1.0
{ | ||
"name": "bs4-modal-react", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "bs4-modal-react React component", | ||
@@ -21,3 +21,5 @@ "main": "lib/index.js", | ||
"storybook": "start-storybook -p 6006", | ||
"build-storybook": "build-storybook" | ||
"build-storybook": "build-storybook", | ||
"deploy": "np", | ||
"postdeploy": "gh-pages -d ./storybook-static/" | ||
}, | ||
@@ -37,2 +39,3 @@ "dependencies": { | ||
"bootstrap": "^4.0.0-beta", | ||
"gh-pages": "^1.0.0", | ||
"jest": "^20.0.4", | ||
@@ -39,0 +42,0 @@ "nwb": "0.18.x", |
@@ -7,4 +7,60 @@ # bs4-modal-react | ||
Describe bs4-modal-react here. | ||
See the storybook demos [here](https://mauricedb.github.io/bs4-modal-react/) | ||
## Install | ||
``` | ||
npm install bs4-modal-react | ||
npm install bootstrap@4.0.0-beta | ||
``` | ||
## Usage | ||
Make sure you include the [Boostrap 4](http://getbootstrap.com/) CSS as that is not included in this package. | ||
```jsx | ||
import React, { Component } from "react"; | ||
import "bootstrap/dist/css/bootstrap.css"; | ||
import { Modal, ModalHeader, ModalTitle, ModalBody, ModalFooter } from "bs4-modal-react"; | ||
class Demo extends Component { | ||
state = { | ||
visible: false | ||
}; | ||
onShow = () => this.setState({ visible: true }); | ||
onHide = () => this.setState({ visible: false }); | ||
onSave = () => { | ||
alert("Saving changes"); | ||
this.onHide(); | ||
}; | ||
render() { | ||
const { visible } = this.state; | ||
return ( | ||
<div> | ||
<button type="button" className="btn btn-primary" onClick={this.onShow}> | ||
Launch modal | ||
</button> | ||
<Modal visible={visible} onHide={this.onHide}> | ||
<ModalHeader> | ||
<ModalTitle>Modal title</ModalTitle> | ||
</ModalHeader> | ||
<ModalBody>Woohoo, you're reading this text in a modal!</ModalBody> | ||
<ModalFooter> | ||
<button type="button" className="btn btn-secondary" onClick={this.onHide}> | ||
Close | ||
</button> | ||
<button type="button" className="btn btn-primary" onClick={this.onSave}> | ||
Save changes | ||
</button> | ||
</ModalFooter> | ||
</Modal> | ||
</div> | ||
); | ||
} | ||
} | ||
``` | ||
[build-badge]: https://img.shields.io/travis/mauricedb/bs4-modal-react/master.png?style=flat-square | ||
@@ -11,0 +67,0 @@ [build]: https://travis-ci.org/mauricedb/bs4-modal-react |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26369
73
0
11