-
-
Save rcanepa/0b83b3f6ed0a6c31fb67a0c1df33cb7a 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
const Link = (props) => { | |
let className = `link link--${props.theme}-theme`; | |
if (!props.underline) className += ' link--no-underline'; | |
return <a href={props.href} className={className}>{props.children}</a>; | |
}; | |
Link.propTypes = { | |
theme: PropTypes.oneOf([ | |
'default', // primary color, no underline | |
'blend', // inherit surrounding styles | |
'primary-button', // primary color, solid block | |
]), | |
underline: PropTypes.bool, | |
href: PropTypes.string.isRequired, | |
children: PropTypes.oneOfType([ | |
PropTypes.element, | |
PropTypes.array, | |
PropTypes.string, | |
]).isRequired, | |
}; | |
Link.defaultProps = { | |
theme: 'default', | |
underline: false, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment