diff --git a/src/components/Link/index.jsx b/src/components/Link/index.jsx index bf884047..db8e47c5 100644 --- a/src/components/Link/index.jsx +++ b/src/components/Link/index.jsx @@ -1,42 +1,46 @@ -import React from 'react' +import React, { forwardRef } from 'react' import PropTypes from 'prop-types' -const Link = ({ - ariaLabel, - children, - className, - href, - icon, - isExternal = false, - linkType, - negative = false, - tabIndex, - title, - onClick = () => {}, - standAlone, - ref, -}) => { - const classNames = `ssb-link${linkType ? ` ${linkType}` : ''}${standAlone ? ' stand-alone' : ''} - ${negative ? ' negative' : ''}${icon ? ' with-icon' : ''}${className ? ` ${className}` : ''}` +const Link = forwardRef( + ( + { + ariaLabel, + children, + className, + href, + icon, + isExternal = false, + linkType, + negative = false, + tabIndex, + title, + onClick = () => {}, + standAlone, + }, + ref + ) => { + const classNames = `ssb-link${linkType ? ` ${linkType}` : ''}${standAlone ? ' stand-alone' : ''} + ${negative ? ' negative' : ''}${icon ? ' with-icon' : ''}${className ? ` ${className}` : ''}` - return ( - // eslint-disable-next-line react/jsx-no-target-blank - - {icon &&
{icon}
} - {children && {children}} -
- ) -} + return ( + // eslint-disable-next-line react/jsx-no-target-blank + + {icon &&
{icon}
} + {children && {children}} +
+ ) + } +) Link.propTypes = { ariaLabel: PropTypes.string, @@ -51,7 +55,6 @@ Link.propTypes = { title: PropTypes.string, onClick: PropTypes.func, standAlone: PropTypes.bool, - ref: PropTypes.object, } export default Link