-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
248 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules/ | |
.idea/ | ||
_book | ||
coverage | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.ReactModal__Overlay { | ||
-webkit-perspective: 600; | ||
perspective: 600; | ||
opacity: 0; | ||
} | ||
|
||
.ReactModal__Overlay--after-open { | ||
opacity: 1; | ||
transition: opacity 150ms ease-out; | ||
} | ||
|
||
.ReactModal__Content { | ||
-webkit-transform: scale(0.5) rotateX(-30deg); | ||
transform: scale(0.5) rotateX(-30deg); | ||
} | ||
|
||
.ReactModal__Content--after-open { | ||
-webkit-transform: scale(1) rotateX(0deg); | ||
transform: scale(1) rotateX(0deg); | ||
transition: all 150ms ease-in; | ||
} | ||
|
||
.ReactModal__Overlay--before-close { | ||
opacity: 0; | ||
} | ||
|
||
.ReactModal__Content--before-close { | ||
-webkit-transform: scale(0.5) rotateX(30deg); | ||
transform: scale(0.5) rotateX(30deg); | ||
transition: all 150ms ease-in; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Modal from '../../lib/index'; | ||
|
||
const appElement = document.getElementById('example'); | ||
|
||
Modal.setAppElement('#example'); | ||
|
||
const MyOverlay = React.createClass({ | ||
render: function() { | ||
const { children, content, ...restProps } = this.props; | ||
|
||
return ( | ||
<div {...restProps} > | ||
{children} | ||
<p | ||
style={{ | ||
position: 'absolute', | ||
bottom: '5px', | ||
right: '20px', | ||
margin: '3px' | ||
}} | ||
> | ||
{content} | ||
</p> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
const App = React.createClass({ | ||
getInitialState: function() { | ||
return { modalIsOpen: false }; | ||
}, | ||
|
||
openModal: function() { | ||
this.setState({modalIsOpen: true}); | ||
}, | ||
|
||
closeModal: function() { | ||
this.setState({modalIsOpen: false}); | ||
}, | ||
|
||
handleModalCloseRequest: function() { | ||
// opportunity to validate something and keep the modal open even if it | ||
// requested to be closed | ||
this.setState({modalIsOpen: false}); | ||
}, | ||
|
||
handleInputChange: function() { | ||
this.setState({foo: 'bar'}); | ||
}, | ||
|
||
render: function() { | ||
return ( | ||
<div> | ||
<button onClick={this.openModal}>Open Modal</button> | ||
<Modal | ||
ref="mymodal" | ||
closeTimeoutMS={150} | ||
isOpen={this.state.modalIsOpen} | ||
onRequestClose={this.handleModalCloseRequest} | ||
overlay={ | ||
<MyOverlay content="Some special content in overlay" /> | ||
} | ||
> | ||
<h1>Note overlay text</h1> | ||
<button onClick={this.closeModal}>close</button> | ||
</Modal> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
ReactDOM.render(<App/>, appElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html public "embarassment"> | ||
<title>Overlay Example</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
<link rel="stylesheet" href="http://instructure-react.github.io/library/shared.css"/> | ||
<link rel="stylesheet" href="app.css"/> | ||
<body> | ||
<header class="branding padbox"> | ||
<h1>react-modal</h1> | ||
<h2>an accessible React modal dialog component</h2> | ||
</header> | ||
<div id="example" class="padbox"></div> | ||
<a target="_top" href="https://github.com/reactjs/react-modal"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://github-camo.global.ssl.fastly.net/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a> | ||
<script src="../__build__/shared.js"></script> | ||
<script src="../__build__/overlay.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { Component, PropTypes } from 'react'; | ||
|
||
export default class ModalOverlay extends Component { | ||
static propTypes = { | ||
className: PropTypes.string, | ||
style: PropTypes.objectOf( | ||
PropTypes.oneOfType([PropTypes.string, PropTypes.number]) | ||
), | ||
onMouseDown: PropTypes.func, | ||
onMouseUp: PropTypes.func, | ||
children: PropTypes.element | ||
}; | ||
|
||
static defaultProps = { | ||
style: {}, | ||
}; | ||
|
||
render () { | ||
const { children, ...restProps } = this.props; | ||
|
||
return ( | ||
<div {...restProps}> | ||
{children} | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import Modal from './components/Modal'; | ||
import ModalOverlay from './components/ModalOverlay'; | ||
|
||
export default Modal; | ||
export { ModalOverlay }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters