Created
August 25, 2017 15:31
-
-
Save gc-codesnippets/d9ebdb03501c2e0f40dc949bc674bf77 to your computer and use it in GitHub Desktop.
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
| import React from 'react' | |
| class CreatePage extends React.Component { | |
| state = { | |
| description: '', | |
| imageUrl: '', | |
| } | |
| render () { | |
| return ( | |
| <div className='w-100 pa4 flex justify-center'> | |
| <div style={{ maxWidth: 400 }} className=''> | |
| <input | |
| className='w-100 pa3 mv2' | |
| value={this.state.description} | |
| placeholder='Description' | |
| onChange={(e) => this.setState({description: e.target.value})} | |
| /> | |
| <input | |
| className='w-100 pa3 mv2' | |
| value={this.state.imageUrl} | |
| placeholder='Image Url' | |
| onChange={(e) => this.setState({imageUrl: e.target.value})} | |
| /> | |
| {this.state.imageUrl && | |
| <img src={this.state.imageUrl} className='w-100 mv3' /> | |
| } | |
| {this.state.description && this.state.imageUrl && | |
| <button className='pa3 bg-black-10 bn dim ttu pointer' onClick={this._handlePost}>Post</button> | |
| } | |
| </div> | |
| </div> | |
| ) | |
| } | |
| _handlePost = () => { | |
| // ... you'll implement this in a bit | |
| } | |
| } | |
| export default CreatePage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment