keycloak-scim/src/components/external-link/ExternalLink.tsx

19 lines
473 B
TypeScript
Raw Normal View History

import React from "react";
import { ExternalLinkAltIcon } from "@patternfly/react-icons";
import { Button, ButtonProps } 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
);
};