UNPKG

standard-resume

Version:
43 lines (35 loc) 960 B
'use strict'; var React = require('react'); var IconLink = React.createClass({ displayName: 'IconLink', propTypes: { href: React.PropTypes.string.isRequired, size: React.PropTypes.oneOf(['small', 'large']), text: React.PropTypes.string, color: React.PropTypes.oneOf(['green']) }, getDefaultProps: function getDefaultProps() { return { size: 'small' }; }, render: function render() { // Just render the text as is if there is no href for the anchor if (!this.props.href) { return React.createElement( 'span', null, this.props.text ); } return React.createElement( 'a', { href: this.props.href, target: '_blank', className: this.props.color === 'green' ? 'c-link green' : 'c-link' }, this.props.text, React.createElement('div', { className: 'icon-link ' + this.props.size }) ); } }); module.exports = IconLink;