Created
March 22, 2016 12:49
-
-
Save andrewjmead/c8406cf3bc0c219beef2 to your computer and use it in GitHub Desktop.
React Weather ErrorModal.jsx Update
This file contains hidden or 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
| var React = require('react'); | |
| var ReactDOM = require('react-dom'); | |
| var ReactDOMServer = require('react-dom/server'); | |
| var ErrorModal = React.createClass({ | |
| getDefaultProps: function () { | |
| return { | |
| title: 'Error' | |
| }; | |
| }, | |
| propTypes: { | |
| title: React.PropTypes.string, | |
| message: React.PropTypes.string.isRequired | |
| }, | |
| componentDidMount: function () { | |
| var {title, message} = this.props; | |
| var modal = ( | |
| <div id="error-modal" className="reveal tiny text-center" data-reveal=""> | |
| <h4>{title}</h4> | |
| <p>{message}</p> | |
| <p> | |
| <button className="button hollow" data-close=""> | |
| Okay | |
| </button> | |
| </p> | |
| </div> | |
| ); | |
| var $modal = $(ReactDOMServer.renderToString(modal)); | |
| var $el = $(ReactDOM.findDOMNode(this)); | |
| $el.html($modal); | |
| this.modal = new Foundation.Reveal($('#error-modal')); | |
| this.modal.open(); | |
| }, | |
| render: function () { | |
| return ( | |
| <div></div> | |
| ); | |
| } | |
| }); | |
| module.exports = ErrorModal; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment