A Pen by colleenDunlap on CodePen.
Created
May 25, 2020 20:11
-
-
Save colleenDunlap/d6c4d04aa034c59604b9d05eb10d2dd5 to your computer and use it in GitHub Desktop.
Datepicker Forecast On A Day
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
<div id="app"></app> |
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
class Application extends React.Component { | |
constructor(props){ | |
super(props) | |
this.state = {date: moment()}; | |
this.dateChanged = this.dateChanged.bind(this); | |
} | |
dateChanged(d){ | |
this.setState({date: d}); | |
} | |
render() { | |
return ( | |
<div> | |
<DatePicker selected={this.state.date} | |
onChange={this.dateChanged} inline /> | |
</div> | |
); | |
} | |
} | |
ReactDOM.render(<Application />, document.getElementById('app')); |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script> | |
<script src="https://unpkg.com/react-onclickoutside@5.7.1"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-datepicker/0.37.0/react-datepicker.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
html, body | |
height: 100% | |
body | |
background: #333 | |
display: flex | |
justify-content: center | |
align-items: center | |
font-family: Helvetica Neue | |
h1 | |
font-size: 2em | |
color: #eee | |
display: inline-block | |
a | |
color: white | |
p | |
margin-top: 1em | |
text-align: center | |
color: #aaa |
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
<link href="https://cdnjs.cloudflare.com/ajax/libs/react-datepicker/0.37.0/react-datepicker.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment