UNPKG

primer-react

Version:
30 lines (24 loc) 660 B
import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import {withSystemProps, COMMON} from './system-props' function BranchName({children, href, is: Tag, className}) { // We don't want someone to use href on a non tag if (Tag !== 'a') { href = null } return ( <Tag href={href} className={classnames('branch-name', className)}> {children} </Tag> ) } BranchName.defaultProps = { is: 'a' } BranchName.propTypes = { children: PropTypes.node, href: PropTypes.string, is: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) } export default withSystemProps(BranchName, COMMON)