forked from solidjs/solid-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick-links.tsx
More file actions
65 lines (60 loc) · 2.11 KB
/
quick-links.tsx
File metadata and controls
65 lines (60 loc) · 2.11 KB
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
import { Icon } from "solid-heroicons";
import { JSXElement, ParentComponent, Show } from "solid-js";
import { A } from "~/ui/i18n-anchor";
import { isExternalURL } from "~/i18n/helpers";
import {
academicCap,
codeBracketSquare,
pencilSquare,
userGroup,
} from "solid-heroicons/solid";
export type QuickLinksProps = {
icon: "learn" | "contribute" | "template" | "community";
title: string;
href: string;
children: JSXElement;
};
const icons = {
learn: academicCap,
contribute: pencilSquare,
community: userGroup,
template: codeBracketSquare,
};
export const QuickLinks: ParentComponent<QuickLinksProps> = (props) => {
return (
<div class="group relative rounded-xl border border-blue-600 dark:border-blue-800 dark:bg-transparent">
<div class="absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.200)),var(--quick-links-hover-bg,theme(colors.sky.200)))_padding-box,linear-gradient(to_top,theme(colors.indigo.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 dark:[--quick-links-hover-bg:theme(colors.slate.800)]" />
<div class="relative overflow-hidden rounded-xl px-5 py-4">
<div class="flex items-center">
<Icon path={icons[props.icon]} class="h-7 w-7 fill-blue-500" />
<div class="text-xl text-slate-900 dark:text-white capitalize no-underline pl-3">
<Show
when={isExternalURL(props.href)}
fallback={
<A
href={props.href}
class="no-underline font-semibold"
addLocale
>
<span class="absolute -inset-px rounded-xl" />
{props.title}
</A>
}
>
<a
href={props.href}
class="no-underline font-semibold bg-gradient-to-br from-blue-400 to-blue-700 inline-block text-transparent bg-clip-text"
>
<span class="absolute -inset-px rounded-xl" />
{props.title}
</a>
</Show>
</div>
</div>
<p class="text-[0.91rem] pl-1 text-balance text-slate-800 dark:text-slate-300 -mb-2">
{props.children}
</p>
</div>
</div>
);
};