feat: open external tools in new tab

Signed-off-by: Deepak Bhardwaj <deepak.bhardwaj@outlook.com>
This commit is contained in:
Deepak Bhardwaj
2021-06-28 21:05:11 +05:30
parent 256c9c9b29
commit f11e50ea71
2 changed files with 12 additions and 1 deletions
@@ -63,6 +63,7 @@ export const ToolCard = ({ card, objectFit }: Props) => {
const classes = useStyles();
const { title, description, url, image, lifecycle, tags } = card;
const isExternalUrl = url.startsWith('https://') || url.startsWith('http://');
return (
<Card key={title}>
@@ -97,7 +98,12 @@ export const ToolCard = ({ card, objectFit }: Props) => {
)}
</CardContent>
<CardActions>
<Button color="primary" href={url} disabled={!url}>
<Button
{...(isExternalUrl ? { target: '_blank' } : {})}
color="primary"
href={url}
disabled={!url}
>
Explore
</Button>
</CardActions>