Skip to content

Instantly share code, notes, and snippets.

@JamesTheHacker
Created September 28, 2018 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesTheHacker/cca3c433fd5011282ffeb5710391d58b to your computer and use it in GitHub Desktop.
Save JamesTheHacker/cca3c433fd5011282ffeb5710391d58b to your computer and use it in GitHub Desktop.
<IconInput error="some shit failed" icon="fa-check" label="Enter email" placeholder="you@email" />
import React from 'react'
export default ({
error,
icon,
label,
placeholder
}) => (
<div className="field">
<label className="label">{label}</label>
<div className="control has-icons-left has-icons-right">
<input
className="input{ terror && ' is-danger' }"
type="email"
placeholder="{placeholder}"
value="hello@"
/>
<span className="icon is-small is-left">
<i className="fas {icon}"></i>
</span>
{
this.props.error &&
<span className="icon is-small is-right">
<i className="fas fa-exclamation-triangle"></i>
</span>
}
</div>
{ this.props.error && <p className="help is-danger">{error}</p> }
</div>
)
class IconInput {
constructor(props) {
super(props);
this.state = {
error: null,
}
}
render() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment