import * as React from 'react'; import { ReactComponent } from '@shopify/react-utilities/types'; import { unstyled } from '../shared'; export interface Props extends React.HTMLProps { // The url to link to. url: string; // Use for a links that open a different site external?: boolean; // The content to display inside link. children?: React.ReactNode; [key: string]: any; // To apply custom styling. componentStyle?: React.CSSProperties; } export type LinkLikeComponent = ReactComponent; let LINKCOMPONENT: LinkLikeComponent; export default class UnstyledLink extends React.PureComponent { static use(newLinkComponent: LinkLikeComponent) { LINKCOMPONENT = newLinkComponent; } render() { if (LINKCOMPONENT) { return ; } const { external = false, url, ...rest } = this.props; const target = external ? '_blank' : undefined; const rel = external ? 'noopener noreferrer' : undefined; return ; } }