Skip to content

Instantly share code, notes, and snippets.

@Rantelo
Last active June 9, 2017 21:00
Show Gist options
  • Select an option

  • Save Rantelo/c9fcfdd74815e684716d35bc7d347a7f to your computer and use it in GitHub Desktop.

Select an option

Save Rantelo/c9fcfdd74815e684716d35bc7d347a7f to your computer and use it in GitHub Desktop.
Presentational Components v1
/**
* Social Media Login Button
*/
export default class SocialMediaLogin extends Component {
constructor(props) {
super(props);
this._getLogo = this._getLogo.bind(this);
}
_getLogo() {
switch(this.props.type) {
case 'facebook':
return require('images/facebook.svg');
case 'google':
return require('images/google.svg');
case 'email':
default:
return require('images/email.svg');
}
}
render() {
return (
<div className={`${this.props.type}-button`}>
<a className='WhiteText' href={`/auth/${this.props.type}`}>
{this.props.label}
</a>
<img className='social-logo' src={this._getLogo()} />
</div>
);
}
}
SocialMediaLogin.defaultProps = {
type: 'email',
label: 'Login'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment