File "ExternalLinkButton.jsx"
Full Path: /home/rubycabfbt/www/wp-content/plugins/envato-elements/src/js/react/components/Buttons/ExternalLinkButton.jsx
File size: 823 bytes
MIME-type: text/plain
Charset: utf-8
import React from 'react'
import PropTypes from 'prop-types'
import ButtonElement from './ButtonElement'
import ButtonIconAndLabel from './ButtonIconAndLabel'
const ExternalLinkButton = ({ type, label, icon, href, openNewWindow, ...additionalProps }) => {
const openNewWindowProps = openNewWindow ? { target: '_blank', rel: 'noopener noreferrer' } : null
return (
<ButtonElement href={href} type={type} element='a' {...openNewWindowProps} {...additionalProps}>
<ButtonIconAndLabel label={label} icon={icon} />
</ButtonElement>
)
}
ExternalLinkButton.propTypes = {
type: PropTypes.string,
label: PropTypes.string,
icon: PropTypes.string,
href: PropTypes.string.isRequired
}
ExternalLinkButton.defaultProps = {
type: 'ghost',
label: null,
icon: null
}
export default ExternalLinkButton