computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
504 B
18 lines
504 B
import React from 'react'; |
|
import { Link } from '@chakra-ui/react'; |
|
|
|
type EnrichedLinkProps = { |
|
href: string; |
|
children: React.ReactNode |
|
} |
|
|
|
export default function EnrichedLink(props: EnrichedLinkProps) { |
|
// Is external URL or is a media URL |
|
const isExternalUrl = /(^http(s)?:\/\/)|(\.(png|svg|jpeg|jpg)$)/.test(props.href); |
|
|
|
return ( |
|
<Link fontWeight={600} href={props.href} target={isExternalUrl ? '_blank' : '_self'} textDecoration='underline'> |
|
{props.children} |
|
</Link> |
|
); |
|
};
|
|
|