|
1
|
import React from "react" |
|
2
|
import { Link } from "../Link" |
|
3
|
import { Badge } from "../Badge" |
|
4
|
import clsx from "clsx" |
|
5
|
import { GithubIcon } from "../Icons/Github" |
|
6
|
|
|
7
|
type SourceCodeLinkProps = { |
|
8
|
link: string |
|
9
|
text?: string |
|
10
|
icon?: React.ReactNode |
|
11
|
className?: string |
|
12
|
} |
|
13
|
|
|
14
|
export const SourceCodeLink = ({ |
|
15
|
link, |
|
16
|
text, |
|
17
|
icon, |
|
18
|
className, |
|
19
|
}: SourceCodeLinkProps) => { |
|
20
|
return ( |
|
21
|
<Link |
|
22
|
href={link} |
|
23
|
target="_blank" |
|
24
|
rel="noreferrer" |
|
25
|
className={clsx("my-docs_0.5 align-middle inline-block", className)} |
|
26
|
> |
|
27
|
<Badge |
|
28
|
variant="neutral" |
|
29
|
className="inline-flex hover:bg-medusa-tag-neutral-bg-hover cursor-pointer" |
|
30
|
childrenWrapperClassName="inline-flex flex-row gap-[3px] items-center" |
|
31
|
> |
|
32
|
{icon || <GithubIcon />} |
|
33
|
<span>{text || "Source Code"}</span> |
|
34
|
</Badge> |
|
35
|
</Link> |
|
36
|
) |
|
37
|
} |