import React from 'react'

/**
 * Sets default values for external links on an anchor tag.
 * @returns
 */
function ExternalLink ({
  href,
  rel = 'nofollow noopener',
  children,
  target = '_blank'
}) {
  return (
    <>
      <a href={href} rel={rel} target={target}>
        <svg
          viewBox='0 0 24 24'
          xmlns='http://www.w3.org/2000/svg'
          style={{ display: 'inline', width: '1rem', marginRight: '0.25rem' }}
        >
          <g>
            <path fill='currentColor' d='M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v8h-2V6.413l-7.793 7.794-1.414-1.414L17.585 5H13V3h8z' />
          </g>
        </svg>
        {children}
      </a>
    </>
  )
}

export default ExternalLink
