Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/flo-bit/flo-bit.github.io. my personal website, w/ astro, svelte, tailwind, typescript, threlte flo-bit.dev
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118---import { Image } from "astro:assets";import ProjectVideo from "./ProjectVideo.svelte";import { cn } from "src/stylingUtils";import type { ImageMetadata } from "astro";
type Props = { projects: Array<{ slug: string; data: { name: string; thumbnail: ImageMetadata; aspect?: string; video?: string; mainTags?: Array<string>; }; }>;};
const { projects } = Astro.props;const videoImports = import.meta.glob("/src/assets/**/*.{mp4,webm}");
// Resolve all video URLs and create a map of paths to URLsconst videoPaths = await Promise.all( Object.entries(videoImports).map(async ([path, importFn]) => { const module = await importFn(); // @ts-expect-error return { path, url: module.default }; }));
// Convert the array of paths and URLs into an object for easy lookupconst videos: Record<string, string> = Object.fromEntries( videoPaths.map(({ path, url }) => [path, url]));
console.log(videos); // This will log an object of paths mapped to URLs---
<div id="projects" class="z-20 py-16 md:py-32 section bg-background relative isolate overflow-hidden"> <div class="mx-auto max-w-5xl px-6 lg:px-8"> <div class="max-w-2xl mb-8"> <h1 class="text-4xl font-bold tracking-tight text-base-800 dark:text-base-100 sm:text-5xl" > things i've made </h1> <div class="hidden mt-6 text-base text-base-600 dark:text-base-400"> i've worked on lots of little side projects over the years, here are some recent ones. many of them are open-source, so if you see something that piques your interest, check out the code.
<!-- <a href="/projects" class="font-semibold text-accent-400 hover:text-accent-300 mt-4" > see all projects <span aria-hidden="true"> →</span> </a> --> </div> </div>
<div class="columns-2 sm:columns-3 sm:text-[0] gap-4 group/projects pointer-events-none" > { projects.map((project) => ( <div class="w-full mb-4"> <div class={cn( "group relative inline-block sm:w-full break-inside-avoid-column pointer-events-auto group-hover/projects:opacity-60 group-focus/projects:opacity-60 hover:!opacity-100 w-full flex-none border border-white/15 focus:border-accent-500 overflow-hidden rounded-3xl focus:!opacity-100 sm:rounded-2xl transition-opacity duration-500", project.data.aspect ?? "aspect-square" )} > {project.data.video ? ( <ProjectVideo video={videos[project.data.video]} client:visible /> ) : null}
<Image src={project.data.thumbnail} alt="" class="absolute inset-0 h-full w-full object-cover rounded-3xl" loading="lazy" width="270" />
{project.data.mainTags ? ( <div class="overflow-hidden absolute pointer-events-none inset-0 w-full h-full flex gap-2 items-start px-3 py-2 md:p-4 tracking-tight leading-6 text-white text-xl font-semibold -translate-y-20 group-hover:translate-y-0 transition-translation duration-200 z-20"> {project.data.mainTags.map((tag: string) => ( <div class="mt-1 text-xs sm:text-xs text-accent-300 bg-accent-950/50 backdrop-blur-sm rounded-full px-2 py-0.5 border border-accent-500/10"> {tag} </div> ))} </div> ) : null}
<div class="overflow-hidden absolute pointer-events-none inset-0 w-full h-full flex items-end px-3 py-2 md:p-4 tracking-tight leading-6 text-white text-xl font-semibold sm:translate-y-20 group-hover:translate-y-0 transition-translation duration-200 z-20"> <div class="mt-1 text-sm sm:text-lg">{project.data.name}</div> </div>
<a href={"/projects/" + project.slug} class="z-20"> <div class="absolute inset-0 rounded-3xl" /> <div class="absolute inset-0 w-full h-full opacity-80 md:opacity-0 group-hover:opacity-90 transition-opacity duration-200 bg-gradient-to-t from-black via-transparent to-black z-10" /> </a> </div> </div> )) } </div> </div></div>