Created
September 28, 2018 21:35
-
-
Save JamesTheHacker/cca3c433fd5011282ffeb5710391d58b to your computer and use it in GitHub Desktop.
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
<IconInput error="some shit failed" icon="fa-check" label="Enter email" placeholder="you@email" /> |
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
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