Skip to content

Commit

Permalink
syntax fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Arashayo committed Jul 27, 2023
1 parent e87d23c commit f5e195b
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions ui/src/components/TextLink/TextLink.jsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import React from 'react';
import './TextLink.scss';
import { FiExternalLink } from 'react-icons/fi';
import PropTypes from 'prop-types';
import React from 'react'
import './TextLink.scss'
import { FiExternalLink } from 'react-icons/fi'
import PropTypes from 'prop-types'

const TextLink = ({ url, text, external }) => {
const handleClick = () => {
external ? window.open(url, '_blank') : window.location.href = url;
};
external ? window.open(url, '_blank') : window.location.href = url
}

return (
<a
href={url}
target={external ? '_blank' : '_self'}
rel={external ? 'noopener noreferrer' : ''}
onClick={handleClick}
className={`text-link ${external ? 'external' :''}`}
className={`text-link ${external ? 'external' : ''}`}
>
{text}
{external && <FiExternalLink className='external-icon'/>}
</a>
);
};
)
}

TextLink.propTypes = {
/** destination URL that the link you want to navigate to*/
url: PropTypes.string.isRequired,
/** content that will be displayed in the link */
text: PropTypes.string.isRequired,
/** boolean that indicates whether the link is external or internal */
external: PropTypes.bool,
};
/** destination URL that the link you want to navigate to */
url: PropTypes.string.isRequired,
/** content that will be displayed in the link */
text: PropTypes.string.isRequired,
/** boolean that indicates whether the link is external or internal */
external: PropTypes.bool,
}

export default TextLink;
export default TextLink

0 comments on commit f5e195b

Please sign in to comment.