From e5cb4e2d7cc254b6bee7a3eb88b48d3ddcea5531 Mon Sep 17 00:00:00 2001 From: Eric Berry Date: Thu, 13 Nov 2014 11:01:29 -0700 Subject: [PATCH] Bootstrap-style modal example --- examples/bootstrap/app.css | 42 +++++++++++++++++++++ examples/bootstrap/app.js | 69 +++++++++++++++++++++++++++++++++++ examples/bootstrap/index.html | 10 +++++ 3 files changed, 121 insertions(+) create mode 100644 examples/bootstrap/app.css create mode 100644 examples/bootstrap/app.js create mode 100644 examples/bootstrap/index.html diff --git a/examples/bootstrap/app.css b/examples/bootstrap/app.css new file mode 100644 index 00000000..8ac90f5c --- /dev/null +++ b/examples/bootstrap/app.css @@ -0,0 +1,42 @@ +body { + font-family: "Helvetica Neue", Arial; + font-weight: 200; + background: #ccc; +} + +.ReactModal__Overlay { + -webkit-perspective: 600; + perspective: 600; + opacity: 0; + overflow-x: hidden; + overflow-y: auto; + background-color: rgba(0, 0, 0, 0.5); +} + +.ReactModal__Overlay--after-open { + opacity: 1; + transition: opacity 150ms ease-out; +} + +.ReactModal__Content { + -webkit-transform: scale(0.5) rotateX(-30deg); +} + +.ReactModal__Content--after-open { + -webkit-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); + transition: all 150ms ease-in; +} + +.ReactModal__Content.modal-dialog { + border: none; + background-color: transparent; +} \ No newline at end of file diff --git a/examples/bootstrap/app.js b/examples/bootstrap/app.js new file mode 100644 index 00000000..5beac9b4 --- /dev/null +++ b/examples/bootstrap/app.js @@ -0,0 +1,69 @@ +/** @jsx React.DOM */ +var React = require('react'); +var Modal = require('../../lib/index'); + +var appElement = document.getElementById('example'); + +Modal.setAppElement(appElement); +Modal.injectCSS(); + +var 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}); + }, + + handleSaveClicked: function(e) { + alert('Save button was clicked'); + }, + + render: function() { + return ( +
+ + +
+
+ +

Modal title

+
+
+

Really long content...

+

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus

+

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus

+

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus

+
+
+ + +
+
+
+
+ ); + } +}); + +React.renderComponent(, appElement); diff --git a/examples/bootstrap/index.html b/examples/bootstrap/index.html new file mode 100644 index 00000000..0e6a2ca2 --- /dev/null +++ b/examples/bootstrap/index.html @@ -0,0 +1,10 @@ + +Bootstrap-Style Example + + + + +
+ + +