import React , { ReactNode } from 'react' ; import * as Styled from './ActionButton.styles' ; export interface Props extends React . ComponentPropsWithoutRef < 'button' > { buttonText : string ; icon : ReactNode ; renderAsLink ? : boolean ; href ? : string ; isLoading ? : boolean ; disabled ? : boolean ; } function param { boolean } renderAsLink param { string } href param { string } buttonText param { ReactNode } icon param { boolean } isLoading param { boolean } disabled param { rest } rest returns { JSX . Element } const ActionButton = ( { buttonText , icon , renderAsLink , isLoading , disabled , href , ... rest } ) : JSX . Element => { if ( renderAsLink && href ) { return ( < Styled . BTN as = { 'a' } href = { href } isLoading = { isLoading } target = { '_blank' } rel = "noopener" > { buttonText } < span > { icon } < /span> < /Styled.BTN>); } return ( < Styled . BTN isLoading = { isLoading } disabled = { disabled } { ... rest } > { buttonText } < span > { icon } < /span> < /Styled.BTN>); } ; export default ActionButton ;