UNPKG

@swrve/core

Version:

Core set of Swrve UI Components

37 lines (29 loc) 815 B
import React from 'react' import classNames from 'classnames' import { node, bool, func, oneOfType, object } from 'prop-types' const Link = ({ children, className, disabled, linkType, ...props }) => { const linkClass = classNames( 'sw-link text-sm text-secondary-100 no-underline', { 'opacity-40 cursor-not-allowed': disabled }, className ) const Link = linkType ? linkType : 'a' return ( <Link className={linkClass} disabled={disabled} {...props}> {children} </Link> ) } Link.displayName = 'Link' Link.propTypes = { /** Contents of the link */ children: node.isRequired, /** Determine if link is disabled */ disabled: bool, /** Optional different link tag */ linkType: oneOfType([func, object]) } Link.defaultProps = { disabled: false } export default Link