diff options
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/404.tsx | 22 | ||||
| -rw-r--r-- | src/pages/Blog.tsx | 90 | ||||
| -rw-r--r-- | src/pages/Home.tsx | 108 | ||||
| -rw-r--r-- | src/pages/Post.tsx | 58 |
4 files changed, 0 insertions, 278 deletions
diff --git a/src/pages/404.tsx b/src/pages/404.tsx deleted file mode 100644 index 5a8da53..0000000 --- a/src/pages/404.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { useNavigate } from "react-router-dom"; -import { useEffect } from "react"; - -export default function NotFound() { - const navigate = useNavigate(); - - useEffect(() => { - const timer = setTimeout(() => { - navigate('/', { replace: true }); - }, 4000); - - return () => clearTimeout(timer); - }, [navigate]); - - return ( - <> - <title>߸ 404</title> - <h1 className="text-2xl font-semibold pt-4">404 - Not found</h1> - <img src="/images/404.webp" className="rounded-lg" /> - </> - ); -} diff --git a/src/pages/Blog.tsx b/src/pages/Blog.tsx deleted file mode 100644 index 1854f47..0000000 --- a/src/pages/Blog.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import { ArrowRight } from "lucide-react"; -import { - Card, - CardContent, - CardHeader, - CardTitle, - CardDescription, -} from "@/components/ui/card"; -import Gallery from "@/components/Gallery"; - -interface Meta { - slug: string; - title: string; - date: string; - excerpt: string; - cover?: string; -} - -const images =[ - { src: "/images/3ds.webp", alt: "Nintendo 3DS", id: 1 }, - { src: "/images/esp32.webp", alt: "ESP 32", id: 2 }, - { src: "/images/manga.webp", alt: "Manga", id: 4 }, - { src: "/images/ocarinaoftime.webp", alt: "Ocarina of Time", id: 6 }, - { src: "/images/hellsparadise.webp", alt: "Hells paradise", id: 7 } -] - -const postFiles = import.meta.glob("../blog/*.md", { eager: true }) as Record< - string, - { attributes: Omit<Meta, "slug"> } ->; - -const posts: Meta[] = Object.entries(postFiles) - .map(([path, mod]) => ({ - slug: path.split("/").pop()!.replace(".md", ""), - ...(mod.attributes as Omit<Meta, "slug">), - })) - .sort( - (a, b) => new Date(b.date).getTime() - new Date(a.date).getTime() - ); - -export default function Blog() { - return ( - <> - <title>߸ blog</title> - <main className="container mx-auto py-12"> - <h1 className="text-3xl font-semibold mb-4"> - Blog Posts - </h1> - <div className="grid gap-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 lg:gap-8"> - {posts.map((post) => ( - <Card className="bg-secondary border border-border p-0" key={post.slug}> - <CardHeader className="p-0"> - <a - href={`/blog/${post.slug}`} - className="block rounded-t-xl overflow-hidden" - > - <img - src={post.cover} - alt={post.title} - className="h-48 w-full object-cover object-center" - style={{ marginTop: 0, paddingTop: 0 }} - /> - </a> - </CardHeader> - <CardContent className="pb-4 px-6"> - <CardTitle className="text-lg font-semibold hover:underline md:text-xl mb-2"> - <a href={`/blog/${post.slug}`}>{post.title}</a> - </CardTitle> - <CardDescription className="mb-4">{post.excerpt}</CardDescription> - <a - href={`/blog/${post.slug}`} - className="inline-flex items-center text-foreground font-medium hover:underline text-sm" - > - Read more - <ArrowRight className="ml-2 size-4" /> - </a> - </CardContent> - </Card> - ))} - </div> - - <section className="mt-12"> - <h2 className="text-2xl font-semibold mb-6">Some images</h2> - <Gallery images={images} /> - </section> - - </main> - </> - ); -} diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx deleted file mode 100644 index de32cda..0000000 --- a/src/pages/Home.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import { useEffect, useState } from "react"; -import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/button"; -import { Card, CardTitle, CardDescription, CardContent } from "@/components/ui/card"; -import { Projects } from "@/data/projects"; -import { Tools } from "@/data/tools"; -import { Github, Mail } from "lucide-react"; - -import { MapContainer, TileLayer, Marker, useMap } from "react-leaflet"; -import L from "leaflet"; -import "leaflet/dist/leaflet.css"; - -const KARLSRUHE: [number, number] = [49.0069, 8.4037]; - -const icon = L.divIcon({ - html: `<div style="width:12px;height:12px;background:#fff;border-radius:50%;border:2px solid #000;box-shadow:0 0 10px rgba(255,255,255,0.5)"></div>`, - className: "", - iconSize: [12, 12], -}); - -function MapEffects() { - const map = useMap(); - useEffect(() => { - map.flyTo(KARLSRUHE, 14, { duration: 3 }); - }, [map]); - return null; -} - -export default function Home() { - const [mounted, setMounted] = useState(false); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - setMounted(true); - const checkDark = () => setIsDark(document.documentElement.classList.contains("dark")); - checkDark(); - const obs = new MutationObserver(checkDark); - obs.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] }); - return () => obs.disconnect(); - }, []); - - if (!mounted) return null; - - const tileUrl = isDark - ? "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png" - : "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png"; - - return ( - <main className="container mx-auto py-12"> - <section className="relative"> - <div - className="relative h-[450px] w-full overflow-hidden rounded-xl border border-border z-0" - style={{ - maskImage: "linear-gradient(to bottom, black 50%, transparent 100%)", - WebkitMaskImage: "linear-gradient(to bottom, black 50%, transparent 100%)" - }} - > - <MapContainer center={[49, 8.4]} zoom={10} scrollWheelZoom={false} className="h-full w-full" zoomControl={false} attributionControl={false}> - <TileLayer key={tileUrl} url={tileUrl} /> - <Marker position={KARLSRUHE} icon={icon} /> - <MapEffects /> - </MapContainer> - </div> - - <div className="relative -mt-32 z-10 text-center"> - <h1 className="text-4xl font-bold mb-4">Hi, <span className="text-blue-500 dark:text-purple-500">I'm Leander.</span></h1> - <p className="text-lg max-w-2xl mx-auto mb-4">Passionate about hardware & software, pursuing computer science studies. Currently building 3D-printing projects and exploring homelabing.</p> - <div className="flex justify-center gap-4"> - <Button asChild className="mt-4"><a href="https://github.com/schererleander" target="_blank" rel="noopener noreferrer"><Github className="mr-2 h-4 w-4" /> Github</a></Button> - <Button asChild className="mt-4 bg-blue-500 dark:bg-purple-500"><a href="mailto:leander@schererleander.de" target="_blank" rel="noopener noreferrer"><Mail className="mr-2 h-4 w-4" /> Mail</a></Button> - </div> - </div> - </section> - - <section className="mt-24"> - <h2 className="text-2xl font-semibold mb-6">Tools & Technologies</h2> - <div className="grid grid-cols-1 md:grid-cols-2 gap-6"> - {Tools.map((t, i) => ( - <Card key={i} className="bg-secondary border border-border p-2"> - <div className="flex items-center px-4 py-2"> - <div className={`p-2 rounded-sm ${t.color}`}><img src={t.image} alt={t.name} className="w-6 h-6" /></div> - <div className="ml-4"><CardTitle>{t.name}</CardTitle><CardDescription>{t.description}</CardDescription></div> - </div> - </Card> - ))} - </div> - </section> - - <section className="mt-24"> - <h2 className="text-2xl font-semibold mb-6">Recent Projects</h2> - <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> - {Projects.map((p, i) => ( - <a key={i} href={p.link} target="_blank" rel="noopener noreferrer"> - <Card className="bg-secondary border border-border py-2 h-full"> - <CardContent> - <img src={p.image} alt={p.name} className="w-full h-48 rounded-lg mb-4 object-cover mx-auto" /> - <CardTitle>{p.name}</CardTitle> - <CardDescription>{p.description}</CardDescription> - <div className="flex flex-wrap gap-2 my-4">{p.badges.map(b => <Badge key={b}>{b}</Badge>)}</div> - </CardContent> - </Card> - </a> - ))} - </div> - </section> - </main> - ); -} diff --git a/src/pages/Post.tsx b/src/pages/Post.tsx deleted file mode 100644 index 83a4c20..0000000 --- a/src/pages/Post.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { useParams, Navigate } from "react-router-dom"; -import { useEffect, type FC } from "react"; - -interface Meta { - title: string; - date: string; - cover?: string; -} - -interface Post { - attributes: Meta; - ReactComponent: FC; -} - -const posts = import.meta.glob<Post>("../blog/*.md", { eager: true }); - -const formDate = new Intl.DateTimeFormat("de-DE", { dateStyle: "medium" }); - -export default function Post() { - const { slug } = useParams(); - - const post = posts[`../blog/${slug}.md`]; - const title = post?.attributes.title ?? "߸ blog post" - - useEffect(() => { - document.title = `߸ ${meta.title}`; - }, [title]) - - if (!post) return <Navigate to="/404" replace />; - - const { attributes: meta, ReactComponent: Content } = post; - - - - return ( - <> - <main> - <a href="/blog" className="no-underline hover:underline"> - ← Back - </a> - - {meta.cover && ( - <img - src={meta.cover} - alt={meta.title} - className="w-full h-60 object-cover rounded-lg my-6" - /> - )} - - <h1 className="text-2xl font-bold mb-4">{meta.title}</h1> - <p className="text-sm text-muted-foreground mb-8">{formDate.format(new Date(meta.date))}</p> - <div className="prose prose-neutral max-w-none prose-img:mx-auto prose-img:w-1/2 prose-img:rounded-lg prose-img:shadow-lg dark:prose-invert"> - <Content /> - </div> - </main> - </> - ); -} |
