-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathAssetCard.astro
More file actions
53 lines (47 loc) · 2.29 KB
/
AssetCard.astro
File metadata and controls
53 lines (47 loc) · 2.29 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
---
interface Props {
asset: Asset;
assetType: "games" | "app";
}
import { Image } from "astro:assets";
import Ban from "lucide-astro/Ban";
import CircleAlert from "lucide-astro/CircleAlert";
import User from "lucide-astro/User";
import type { Asset } from "@/lib/assets.ts";
const { asset, assetType } = Astro.props;
export const prerender = false;
---
<div data-asset={JSON.stringify(asset)} data-asset-card class="group relative cursor-pointer" role="button" tabindex="0">
<div class="relative overflow-hidden rounded bg-white/[0.03] border border-white/10 hover:border-white/25 hover:bg-white/[0.06] transition-all">
{
asset.custom && (
<button
type="button"
data-asset-remove={JSON.stringify({ type: assetType, id: asset.id, name: asset.name, link: asset.link, image: asset.image })}
class="absolute right-1.5 top-1.5 z-10 flex h-5 w-5 items-center justify-center rounded-full bg-black/70 text-white/80 hover:text-white hover:bg-black/90 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-auto"
aria-label="Remove"
>
✕
</button>
)
}
{
asset.image?.startsWith("/") ? (
<Image loading="lazy" src={asset.image} alt={asset.name} height={128} width={128} class="w-full aspect-square object-cover opacity-90 group-hover:opacity-100 group-hover:scale-105 transition-all duration-300" />
) : (
<img loading="lazy" src={asset.image} alt={asset.name} class="w-full aspect-square object-cover opacity-90 group-hover:opacity-100 group-hover:scale-105 transition-all duration-300" />
)
}
<div class="absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity">
<div class="absolute bottom-0 left-0 right-0 p-3">
<div class="flex items-center gap-1.5">
{asset.custom && <User class="w-3 h-3 text-accent" strokeWidth={1.5} />}
{asset.partial && <CircleAlert class="w-3 h-3 text-yellow-500" strokeWidth={1.5} />}
{asset.error && <Ban class="w-3 h-3 text-red-500" strokeWidth={1.5} />}
<span class="text-xs text-white font-medium truncate">{asset.name}</span>
</div>
</div>
</div>
</div>
</div>
<script src="@/lib/assets.ts"></script>