2020-09-01 14:51:59 +00:00
|
|
|
import React from "react";
|
|
|
|
import { ExternalLinkAltIcon } from "@patternfly/react-icons";
|
2020-09-21 20:12:53 +00:00
|
|
|
import { Button } from "@patternfly/react-core";
|
2020-09-01 08:25:24 +00:00
|
|
|
|
2020-09-22 12:26:01 +00:00
|
|
|
export const ExternalLink = ({ title, href, ...rest }: ButtonProps) => {
|
2020-09-01 08:25:24 +00:00
|
|
|
return (
|
2020-09-21 20:12:53 +00:00
|
|
|
<Button
|
|
|
|
variant="link"
|
|
|
|
icon={href?.startsWith("http") && <ExternalLinkAltIcon />}
|
|
|
|
iconPosition="right"
|
|
|
|
component="a"
|
|
|
|
href={href}
|
|
|
|
{...rest}
|
|
|
|
>
|
|
|
|
{title ? title : href}
|
|
|
|
</Button>
|
2020-09-01 08:25:24 +00:00
|
|
|
);
|
|
|
|
};
|