diff --git a/apps/www/src/routes/index.tsx b/apps/www/src/routes/index.tsx index 0c4d4ce8..a8ab026f 100644 --- a/apps/www/src/routes/index.tsx +++ b/apps/www/src/routes/index.tsx @@ -1,8 +1,7 @@ import { component$ } from "@builder.io/qwik"; -import { Link, type DocumentHead } from "@builder.io/qwik-city"; +import { type DocumentHead } from "@builder.io/qwik-city"; import { HeroSection, Cursor, MotionComponent, transition } from "@nestri/ui/react" -import { NavBar, Footer, Modal } from "@nestri/ui" -import { BasicImageLoader } from "@nestri/ui/image"; +import { NavBar, Footer, Modal, Card } from "@nestri/ui" const features = [ { @@ -50,32 +49,37 @@ const games = [ { title: "Apex Legends", rotate: -5, - image: "https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/1172470/library_600x900_2x.jpg", - link: "/games/apex-legends" + titleWidth: 31.65, + titleHeight: 82.87, + id: 1172470, }, { title: "Control Ultimate Edition", rotate: 3, - image: "https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/870780/library_600x900_2x.jpg", - link: "/games/control-ultimate-edition" + titleWidth: 55.61, + titleHeight: 100, + id: 870780, }, { title: "Black Myth: Wukong", rotate: -3, - image: "https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/2358720/library_600x900_2x.jpg", - link: "/games/black-myth-wukong" + titleWidth: 56.30, + titleHeight: 69.79, + id: 2358720, }, { title: "Shell Runner - Prelude", rotate: 2, - image: "https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/2581970/library_600x900_2x.jpg", - link: "/games/shell-runner-prelude" + id: 2581970, + titleWidth: 72.64, + titleHeight: 91.26, }, { title: "Counter-Strike 2", rotate: -5, - image: "https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/730/library_600x900_2x.jpg", - link: "/games/counter-strike-2" + id: 730, + titleWidth: 50.51, + titleHeight: 99.65, }, { title: "Add from Steam", @@ -167,22 +171,58 @@ export default component$(() => {
{games.map((game, index) => ( - - {game.image ? : + game.titleWidth ? ( + + ) : ( +
+ + ) + + // + // { : + //
+ //

Can't find your game here?

+ // + // Import from Steam + // + //
} + // ))}
diff --git a/packages/ui/src/card.tsx b/packages/ui/src/card.tsx index f06dc419..d7f9b29b 100644 --- a/packages/ui/src/card.tsx +++ b/packages/ui/src/card.tsx @@ -1,18 +1,21 @@ -import { $, component$, useVisibleTask$ } from "@builder.io/qwik"; +import { $, component$, type PropsOf, useVisibleTask$ } from "@builder.io/qwik"; import { Modal, Portal } from "@nestri/ui"; import { cn } from "@nestri/ui/design" +import { BasicImageLoader } from "./image"; -type Props = { +interface Props extends PropsOf<"button"> { game: { name: string; id: number; }, - size: "small" | "large"; + size: "xs" | "small" | "large"; titleWidth: number; titleHeight: number; } -export const Card = component$(({ titleWidth, titleHeight, game, size }: Props) => { +//TODO: Show gradient animation while image loads + +export const Card = component$(({ titleWidth, titleHeight, game, size, ...props }: Props) => { const modalUrl = `https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/${game.id}/library_hero.jpg`; const imageUrl = size == "large" ? `https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/${game.id}/header.jpg` : `https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/${game.id}/library_600x900_2x.jpg`; @@ -31,14 +34,14 @@ export const Card = component$(({ titleWidth, titleHeight, game, size }: Props) // eslint-disable-next-line qwik/no-use-visible-task useVisibleTask$(async () => { await loadModalImages(); - // imagesLoaded.value = true; }); return ( {size === "large" ? ( + class="min-w-[250px] h-[350px] lg:flex-row flex-col group overflow-hidden hover:ring-primary-500 focus:ring-primary-500 outline-none cursor-pointer backdrop-blur-sm select-none w-full group rounded-[20px] duration-200 flex transition-all gap-2 px-4 py-3 ring-[3px] ring-gray-200 dark:ring-gray-800 text-gray-900/70 dark:text-gray-100/70 bg-gray-200/70 dark:bg-gray-800/70" + {...props}>
@@ -49,7 +52,7 @@ export const Card = component$(({ titleWidth, titleHeight, game, size }: Props)
{[1, 2, 3, 4, 5].map((_, index) => (
- +
))}
@@ -63,31 +66,39 @@ export const Card = component$(({ titleWidth, titleHeight, game, size }: Props)
- {game.name} -
-
) : ( - -
-
-

{game.name}

-
-
-
- {game.name}
+
) : size == "small" ? ( + +
+
+

{game.name}

+
+
+
+ +
+
+ ) : ( + + )}