Skip to content

Instantly share code, notes, and snippets.

@gc-codesnippets
Created August 25, 2017 15:31
Show Gist options
  • Select an option

  • Save gc-codesnippets/d9ebdb03501c2e0f40dc949bc674bf77 to your computer and use it in GitHub Desktop.

Select an option

Save gc-codesnippets/d9ebdb03501c2e0f40dc949bc674bf77 to your computer and use it in GitHub Desktop.
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