1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/*
* SPDX-FileCopyrightText: 2024 Kristóf Marussy
*
* SPDX-License-Identifier: MIT
*/
import Link, { type Props as LinkProps } from '@docusaurus/Link';
import { Certificate, Lock } from '@phosphor-icons/react';
import { CreativeCommonsIcon } from '@site/src/components/icons';
import styles from './licenses.module.css';
export type LicenseLinkProps = LinkProps & { label?: string };
export function LicenseLink({ children, label, ...props }: LicenseLinkProps) {
return (
<Link className={styles.link} {...props}>
<Certificate weight="bold" aria-hidden="true" className={styles.icon} />
<span className="sr-only">{label ?? 'License'}: </span>
{children}
</Link>
);
}
export function MITLicenseLink() {
return <LicenseLink to="https://spdx.org/licenses/MIT.html">MIT</LicenseLink>;
}
export function CCLicenseLink({ children, label, ...props }: LicenseLinkProps) {
return (
<Link className={styles.link} {...props}>
<CreativeCommonsIcon className={styles.icon} hidden />
<span className="sr-only">{label ?? 'Creative Commons license'}: </span>
{children}
</Link>
);
}
export function CCBYLicenseLink() {
return (
<CCLicenseLink to="https://creativecommons.org/licenses/by/4.0/">
CC-BY-4.0
</CCLicenseLink>
);
}
export function ClosedAccessLink({
children,
label,
...props
}: LicenseLinkProps) {
return (
<Link className={styles.link} {...props}>
<Lock weight="bold" aria-hidden="true" className={styles.icon} />
<span className="sr-only">{label ?? 'Closed access'}: </span>
{children}
</Link>
);
}
export type SpanProps = React.DetailedHTMLProps<
React.HTMLAttributes<HTMLSpanElement>,
HTMLSpanElement
>;
export function LicenseText({ children, ...props }: SpanProps) {
return (
<span className={styles.text} {...props}>
<Certificate weight="bold" aria-hidden="true" className={styles.icon} />
{children}
</span>
);
}
export function CCLicenseText({ children, ...props }: SpanProps) {
return (
<span className={styles.text} {...props}>
<CreativeCommonsIcon className={styles.icon} hidden />
{children}
</span>
);
}
export function ClosedAccessText({ children, ...props }: SpanProps) {
return (
<span className={styles.text} {...props}>
<Lock weight="bold" aria-hidden="true" className={styles.icon} />
{children}
</span>
);
}
|