diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-10-13 00:38:37 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-10-13 00:38:37 +0800 |
| commit | 433e08f2f798b4c04d57cd2d61b16a58aa5196be (patch) | |
| tree | 699df47962e2fc921c9ddde8a034f41af92b3c63 | |
| parent | 308eb96365a7cee0ebc8118673c3b6c85497ce3e (diff) | |
core: added home page
| -rw-r--r-- | app/index.css | 11 | ||||
| -rw-r--r-- | app/layout.tsx | 71 | ||||
| -rw-r--r-- | app/lib/fonts.tsx | 41 | ||||
| -rw-r--r-- | app/lib/isMobile.tsx | 9 | ||||
| -rw-r--r-- | app/page.tsx | 127 | ||||
| -rw-r--r-- | app/selector.css | 3 | ||||
| -rw-r--r-- | app/styles.css | 467 | ||||
| -rw-r--r-- | components/blob.tsx | 175 | ||||
| -rw-r--r-- | components/hacktype.tsx | 55 | ||||
| -rw-r--r-- | components/header.css | 123 | ||||
| -rw-r--r-- | components/header.tsx | 39 | ||||
| -rw-r--r-- | components/theme-provider.tsx | 9 |
12 files changed, 1002 insertions, 128 deletions
diff --git a/app/index.css b/app/index.css new file mode 100644 index 0000000..12bd95b --- /dev/null +++ b/app/index.css @@ -0,0 +1,11 @@ +.title { + font-size: 7vw; + text-shadow: 15px 15px 15px var(--shadow-color); +} + +.window { + top: 15%; + left: 10%; + height: 70%; + width: 80%; +}
\ No newline at end of file diff --git a/app/layout.tsx b/app/layout.tsx index a36cde0..f7adc6e 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,35 +1,48 @@ import type { Metadata } from "next"; -import localFont from "next/font/local"; -import "./globals.css"; - -const geistSans = localFont({ - src: "./fonts/GeistVF.woff", - variable: "--font-geist-sans", - weight: "100 900", -}); -const geistMono = localFont({ - src: "./fonts/GeistMonoVF.woff", - variable: "--font-geist-mono", - weight: "100 900", -}); +// import { Inter, Audiowide, Rock_Salt, Monoton, JetBrains_Mono } from 'next/font/google' +import "./styles.css"; +import { ThemeProvider } from "@/components/theme-provider" +import Header from "@/components/header"; +import { MonotonFont, RockSaltFont, InterFont, JetBrainsMonoFont } from "./lib/fonts"; + +// const programFont = localFont({ +// src: "/fonts/LigaJetBrainsMonoNerdFont-Regular.ttf" +// }) + +// const monotonFont = localFont({ +// src: "/fonts/Monoton.ttf" +// }) + +// const rocksaltFont = localFont({ +// src: "/fonts/RockSalt-Regular.ttf" +// }) + +// const audiowideFont = localFont({ +// src: "/fonts/audiowide.ttf" +// }) + +// const interFont = localFont({ +// src: "/fonts/Inter.ttf" +// }) export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", + title: "littleblack111", + description: "littleblack111 is a full stack developer, who uses arch btw", + keywords: ["littleblack111", "full stack", "developer", "arch", "btw"], + authors: [{name: "littleblack111", url: "https://littleblack111.com"}], + creator: "littleblack111", + }; -export default function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - return ( - <html lang="en"> - <body - className={`${geistSans.variable} ${geistMono.variable} antialiased`} - > - {children} - </body> - </html> - ); +export default function RootLayout({children,}: Readonly<{children: React.ReactNode;}>) { + return ( + <html lang="en"> + <body className={`${MonotonFont.variable} ${RockSaltFont.variable} ${InterFont.variable} ${JetBrainsMonoFont.variable}`}> + <Header /> + <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange> + {children} + </ThemeProvider> + </body> + </html> + ); } diff --git a/app/lib/fonts.tsx b/app/lib/fonts.tsx new file mode 100644 index 0000000..3edbc52 --- /dev/null +++ b/app/lib/fonts.tsx @@ -0,0 +1,41 @@ +import localFont from "next/font/local"; +import { Inter, Audiowide, Rock_Salt, Monoton, JetBrains_Mono } from 'next/font/google' + +export const InterFont = Inter({ + variable: "--font-inter", + subsets: ['latin'], + display: 'swap', +}) + +export const MonotonFont = Monoton({ + weight: ['400'], + variable: "--font-monoton", + subsets: ['latin'], + display: 'swap', +}) + +export const RockSaltFont = Rock_Salt({ + weight: ['400'], + variable: "--font-rocksalt", + subsets: ['latin'], + display: 'swap', +}) + +export const JetBrainsMonoFont = JetBrains_Mono({ + weight: ['400'], + variable: "--font-jetbrains", + subsets: ['latin'], + display: 'swap', +}) + +export const hackedFont = localFont({ + src: "../fonts/Hacked-KerX.ttf" +}) + +export const smoothFont = localFont({ + src: "../fonts/SmoothElegantRegular-ZLv3.ttf" +}) + +export const bigFont = localFont({ + src: "../fonts/Big500-8MLOM.ttf" +})
\ No newline at end of file diff --git a/app/lib/isMobile.tsx b/app/lib/isMobile.tsx new file mode 100644 index 0000000..4ad8b03 --- /dev/null +++ b/app/lib/isMobile.tsx @@ -0,0 +1,9 @@ +"use server" + +import { userAgent } from 'next/server' +import { headers } from 'next/headers'; + +export default async function isMobile() { + const { device } = userAgent({ headers: headers() }); + return device.type === 'mobile'; +}
\ No newline at end of file diff --git a/app/page.tsx b/app/page.tsx index 433c8aa..c27a6f6 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,101 +1,30 @@ -import Image from "next/image"; +"use client" + +import "./selector.css"; +import "./index.css"; +import Blob from "@/components/blob"; +import { cn } from "@/lib/utils"; +import HackType from "@/components/hacktype"; +import Parallax from "react-next-parallax"; -export default function Home() { - return ( - <div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]"> - <main className="flex flex-col gap-8 row-start-2 items-center sm:items-start"> - <Image - className="dark:invert" - src="https://nextjs.org/icons/next.svg" - alt="Next.js logo" - width={180} - height={38} - priority - /> - <ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]"> - <li className="mb-2"> - Get started by editing{" "} - <code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold"> - app/page.tsx - </code> - . - </li> - <li>Save and see your changes instantly.</li> - </ol> - <div className="flex gap-4 items-center flex-col sm:flex-row"> - <a - className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5" - href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app" - target="_blank" - rel="noopener noreferrer" - > - <Image - className="dark:invert" - src="https://nextjs.org/icons/vercel.svg" - alt="Vercel logomark" - width={20} - height={20} - /> - Deploy now - </a> - <a - className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44" - href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app" - target="_blank" - rel="noopener noreferrer" - > - Read our docs - </a> - </div> - </main> - <footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center"> - <a - className="flex items-center gap-2 hover:underline hover:underline-offset-4" - href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app" - target="_blank" - rel="noopener noreferrer" - > - <Image - aria-hidden - src="https://nextjs.org/icons/file.svg" - alt="File icon" - width={16} - height={16} - /> - Learn - </a> - <a - className="flex items-center gap-2 hover:underline hover:underline-offset-4" - href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app" - target="_blank" - rel="noopener noreferrer" - > - <Image - aria-hidden - src="https://nextjs.org/icons/window.svg" - alt="Window icon" - width={16} - height={16} - /> - Examples - </a> - <a - className="flex items-center gap-2 hover:underline hover:underline-offset-4" - href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app" - target="_blank" - rel="noopener noreferrer" - > - <Image - aria-hidden - src="https://nextjs.org/icons/globe.svg" - alt="Globe icon" - width={16} - height={16} - /> - Go to nextjs.org → - </a> - </footer> - </div> - ); -} +export default function Home() { + return ( + <div className={cn("h-screen w-full top-0 left-0 overflow-hidden fixed -z-6")}> + <section className={cn("overflow-hidden top-0 left-0 m-0 p-0 w-full h-full bg-center bg-no-repeat bg-cover text-foreground dark:text-dforground bg-background dark:bg-dbackground")}> + <Parallax fullPageListening spotGlareEnable={false} lineGlareEnable={false} className={cn("tilt relative top-[15%] left-[10%] h-[70%] w-[80%] bg-transparent flex justify-center items-center z-[999] overflow-visible")}> + <div className={cn("relative w-full h-full border border-white rounded-[1em] flex justify-center items-center text-center z-[11] shadow-[0_0_100px_rgba(5,1,13,0.4)]")}> + <div className="relative w-full text-center"> + <h2 className="font-inter text-[2.5vw] " data-parallax-offset="-5">Hello! I'm</h2> + <div className={cn("font-monoton uppercase text-[7vw] transition-all text-shadow-[15px_15px_15px_black]")}> + <HackType text="littleblack111" data-parallax-offset="5"/> + </div> + <div className={cn("font-inter text-[2.5vw] transition-all text-shadow-[15px_15px_15px_black]")} data-parallax-offset="-5">welcome to my website!</div> + </div> + </div> + </Parallax> + </section> + <Blob blobtype="random"/> + </div> + ); +}
\ No newline at end of file diff --git a/app/selector.css b/app/selector.css new file mode 100644 index 0000000..0921476 --- /dev/null +++ b/app/selector.css @@ -0,0 +1,3 @@ +:root { + --text: #F4E8C1 +}
\ No newline at end of file diff --git a/app/styles.css b/app/styles.css new file mode 100644 index 0000000..df2ad4f --- /dev/null +++ b/app/styles.css @@ -0,0 +1,467 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +body { + font-family: Arial, Helvetica, sans-serif; +} + +@layer utilities { + .text-balance { + text-wrap: balance; + } +} + +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 0 0% 3.9%; + --card: 0 0% 100%; + --card-foreground: 0 0% 3.9%; + --popover: 0 0% 100%; + --popover-foreground: 0 0% 3.9%; + --primary: 0 0% 9%; + --primary-foreground: 0 0% 98%; + --secondary: 0 0% 96.1%; + --secondary-foreground: 0 0% 9%; + --muted: 0 0% 96.1%; + --muted-foreground: 0 0% 45.1%; + --accent: 0 0% 96.1%; + --accent-foreground: 0 0% 9%; + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 0 0% 98%; + --border: 0 0% 89.8%; + --input: 0 0% 89.8%; + --ring: 0 0% 3.9%; + --chart-1: 12 76% 61%; + --chart-2: 173 58% 39%; + --chart-3: 197 37% 24%; + --chart-4: 43 74% 66%; + --chart-5: 27 87% 67%; + --radius: 0.5rem; + --topBarHeight: 5em; + --neon-bg-color: #05010d; + --dark-background: 260 86% 3%; + --dark-foreground: 0 0% 98%; + --dark-card: 0 0% 3.9%; + --dark-card-foreground: 0 0% 98%; + --dark-popover: 0 0% 3.9%; + --dark-popover-foreground: 0 0% 98%; + --dark-primary: 0 0% 98%; + --dark-primary-foreground: 0 0% 9%; + --dark-secondary: 0 0% 14.9%; + --dark-secondary-foreground: 0 0% 98%; + --dark-muted: 0 0% 14.9%; + --dark-muted-foreground: 0 0% 63.9%; + --dark-accent: 0 0% 14.9%; + --dark-accent-foreground: 0 0% 98%; + --dark-destructive: 0 62.8% 30.6%; + --dark-destructive-foreground: 0 0% 98%; + --dark-border: 0 0% 14.9%; + --dark-input: 0 0% 14.9%; + --dark-ring: 0 0% 83.1%; + --dark-chart-1: 220 70% 50%; + --dark-chart-2: 160 60% 45%; + --dark-chart-3: 30 80% 55%; + --dark-chart-4: 280 65% 60%; + --dark-chart-5: 340 75% 55%; + --shadow-color: black; + } + * { + @apply border-border; + } + body { + @apply bg-background text-foreground; + } +} + + + +/* page setup ============================================= */ + +* { + padding: 0; + margin: 0; + -webkit-font-smoothing: antialiased; + font-smooth: antialiased; +} + +@media (pointer:none), (pointer:coarse) { + * { + transition: all .3s; + } +} + +body { + top: 0; + left: 0; + transition: background 1s ease-in-out; +} + +body::-webkit-scrollbar { + display: none; +} + +/* animation ============================================== */ + +@keyframes slideInTop { + from { + transform: translateY(-300px); + } + to { + transform: translateY(0); + } +} + +@keyframes bounce { + 0%, 20%, 50%, 80%, 100% { + transform: translateY(0px); + } + 40% { + transform: translateY(30px); + } + 80% { + transform: translateY(-15px); + } +} + +@keyframes zoomIn { + 0% { + scale: 0.01; + } + 65% { + scale: 1.05; + } + 100% { + scale: 1; + position: relative; + } +} + +@keyframes zoomOut { + from { + transform: scale(1); + } + to { + transform: scale(0.01); + } +} + +@keyframes fadeZoomIn { + from { + opacity: 0.35; + scale: 1.15; + } + to { + opacity: 1; + scale: 1; + } +} + +@keyframes reveal { + from { + -webkit-filter: blur(32px); + -moz-filter: blur(32px); + -o-filter: blur(32px); + -ms-filter: blur(32px); + filter: blur(32px); + -webkit-backdrop-filter: blur(32px); + backdrop-filter: blur(32px); + transform: scale(2); + } +} + +@keyframes shake { + 0% { transform: rotate(0deg); } + 25% { transform: rotate(.5deg); } + 50% { transform: rotate(0eg); } + 75% { transform: rotate(-.5deg); } + 100% { transform: rotate(0deg); } +} + +@keyframes background-pan { + from { + background-position: 0% center; + } + to { + background-position: -200% center; + } +} + +@keyframes fadeIn { + from { + scale: 0.8; + opacity: 0; + } + to { + opacity: 1; + scale: 1; + } +} + +@keyframes fadeOut { + from { + + } + to { + opacity: 0; + scale: 0.8 + } +} + +@keyframes scroll { + from { + opacity: 0.8; + scale: 0.75; + } + to { + opacity: 1; + scale: 1; + } +} + +@keyframes rotate { + from { + rotate: 0deg; + } + + 50% { + scale: 1 1.25; + } + + to { + rotate: 360deg; + } +} + +@keyframes minimize { + from { + scale: 1; + opacity: 1; + } + to { + scale: 0; + opacity: 0; + } +} + + +/* animation: name duration timing-function delay iteration-count direction fill-mode; */ + + +/* animate class */ +.animate { + -webkit-animation-duration: 0.5s; + animation-duration: 0.5s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +.animate.animate--infinite { + -webkit-animation-iteration-count: infinite; + animation-iteration-count: infinite; +} + +.animate.animation--delay-1s { + -webkit-animation-delay: 1s; + animation-delay: 1s; +} +.animate.animation--delay-p5s { + -webkit-animation-duration: 0.5s; + animation-duration: 0.5s; + animation-delay: 0.5s; +} + +.animate.animation--delay-p3s { + -webkit-animation-duration: 0.3s; + animation-duration: 0.3s; + animation-delay: 0.3s; +} + +.animate.animation--fast { + -webkit-animation-duration: 0.3s; + animation-duration: 0.3s; +} + +.animate.animation--slow { + -webkit-animation-duration: 1s; + animation-duration: 1s; +} + +/* real utility classes */ + +.animate.slideInTop { + animation-name: slideInTop; + -webkit-transition-timing-function: ease-in; + transition-timing-function: ease-in; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; +} + +.animate.bounce { + -webkit-animation-name: bounce; + animation-name: bounce; +} + +.animate.zoomIn { + -webkit-transition-timing-function: linear; + transition-timing-function: linear; + -webkit-animation-name: reveal; + animation-name: zoomIn; +} + +.animate.zoomOut { + -webkit-transition-timing-function: linear; + transition-timing-function: linear; + -webkit-animation-name: zoomOut; + animation-name: zoomOut; +} + +.animate.reveal { + animation-duration: 500ms; + -webkit-transition-timing-function: linear; + transition-timing-function: linear; + -webkit-animation-name: reveal; + animation-name: reveal; +} + +.animate.shake { + -webkit-animation-name: shake; + animation-name: shake; +} + +.animate.fadeIn { + -webkit-animation-name: fadeIn; + animation-name: fadeIn; +} + +.animate.fadeOut { + -webkit-animation-name: fadeOut; + animation-name: fadeOut; +} + +.animate.fadeZoomIn { + -webkit-animation-name: fadeZoomIn; + animation-name: fadeZoomIn; +} + +.aniamte.persist { + animation-fill-mode: forwards; +} + +/* transition */ +/* * { + -webkit-transition: all 0.3s; + transition: all 0.3s; +} */ + +@media (prefers-reduced-motion: no-preference) { + :has(:target) { + scroll-behavior: smooth; + } +} + +:has(:target) { + scroll-padding-top: var(--topBarHeight); +} + + +.js-tilt-glare { + border-radius: 18px; + overflow: hidden; +} + +/* other ================================================== */ + +/* a { + outline: 3px solid currentColor; + outline-offset: -6px; +} */ + +a:hover, Button:hover { + font-weight: bold; + text-decoration: underline; + text-decoration-thickness: 3px; + -webkit-text-decoration-line: underline; + text-decoration-line: underline; + cursor: pointer; + transition-timing-function: cubic-bezier(.4,0,.2,1); + transition-duration: .15s; + text-underline-offset: 1px; + position: relative; + height: 100%; + /* font-size: 5mm; */ + text-transform: capitalize; + text-align: center; + /* start */ + margin-left: 5mm; + margin-right: 5mm; + padding-top: 3mm; + padding-bottom: 3mm; + /* end + these lines will make it more appearence and jigully when hovered */ + font-weight: bold; + -webkit-transition: all .5s; + transition: all .5s; + /* border-radius: 8px; */ + /* color: #F4E8C1; */ +} + +a:active, Button:active { + transform: scale(0.9); +} + +.blob { + min-height: 75%; + min-width: 75%; + /* aspect-ratio: 1; */ + background-color: #fff; + background: -webkit-gradient(linear, left top, right top, from(#00FFFF), to(mediumpurple)); + background: linear-gradient(90deg,#0ff,#9370db); + border-radius: 50%; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; + filter: blur(7vmax); + -webkit-filter: blur(7vmax); + height: 15vmax; + left: 50%; + opacity: 0; + position: absolute; + top: 50%; + translate: -50% -50%; + width: 20vmax; + z-index: 0; + animation-fill-mode: forwards; +} + + +.sblob { + background-color: white; + height: 15vmax; + width: 20vmax; + aspect-ratio: 1; + position: absolute; + left: 50%; + top: 50%; + translate: -50% -50%; + border-radius: 50%; + background: conic-gradient(#00FFFF, mediumpurple); + animation: rotate 20s infinite; + opacity: 0.8; + filter: blur(7vmax); + -webkit-filter: blur(7vmax); + z-index: -1; +} + + +html.is-changing .openlink { + transition: all 0.5s; +} + +html.is-animating .openlink { + /* transform: scale(1000); + transition: transform 100s; */ + transition: all 0.5s; + height: 100%; + width: 100%; + transition-timing-function: ease-out; +} diff --git a/components/blob.tsx b/components/blob.tsx new file mode 100644 index 0000000..de80ad8 --- /dev/null +++ b/components/blob.tsx @@ -0,0 +1,175 @@ +"use client" +import React, { useState, useEffect, useRef } from 'react'; +import isMobile from '@/app/lib/isMobile'; + +// components/RandomBlob.tsx +function getRandomInt(min: number, max: number): number { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +function getRandomColor(): string { + const letters = '0123456789ABCDEF'; + let color = '#'; + for (let i = 0; i < 6; i++) { + color += letters[Math.floor(Math.random() * 16)]; + } + return color; +} + +function generateGradient(): string { + let gradient = 'conic-gradient('; + let firstTimeInter = true; + const colorCount = Math.floor(Math.random() * 5) + 2; + for (let i = 0; i < colorCount; i++) { + if (firstTimeInter) { + gradient += getRandomColor(); + firstTimeInter = false; + } else { + gradient += ', ' + getRandomColor(); + } + } + gradient += ')'; + return gradient; +} + +const RandomBlob: React.FC = () => { + const blobRef = useRef<HTMLDivElement>(null); + const [isResetting, setIsResetting] = useState(false); + const [isFirstTime, setIsFirstTime] = useState(true); + const [mainInterval, setMainInterval] = useState<NodeJS.Timeout | null>(null); + + const randomPosition = (element: HTMLElement) => { + const x = getRandomInt(0, window.innerWidth); + const y = getRandomInt(0, window.innerHeight); + element.style.position = 'absolute'; + element.style.left = `${x}px`; + element.style.top = `${y}px`; + }; + + function setRandomBlob() { + if (blobRef.current) { + blobRef.current.style.width = `${getRandomInt(50, 100)}%`; + blobRef.current.style.height = `${getRandomInt(50, 100)}%`; + blobRef.current.style.transform = `rotate(${getRandomInt(0, 360)}deg)`; + } + }; + + function rrestblob() { + setRandomBlob(); + blobRef.current!.style.background = generateGradient(); + randomPosition(blobRef.current!); + const fadeInAnimation = blobRef.current!.animate([ + { opacity: 0 }, + { opacity: 0.4 } + ], { + duration: 3000, + iterations: 1, + fill: 'forwards' + }); + + fadeInAnimation?.addEventListener('finish', () => { + setIsResetting(false); + }); + } + + function resetBlob() { + if (blobRef.current) { + if (isResetting) { + return; + } + if (!isFirstTime) { + blobRef.current?.animate([ + { opacity: 0.4 }, + { opacity: 0, transform: 'scale(0.8)' } + ], { + duration: 3000, + iterations: 1, + fill: 'forwards' + }).addEventListener('finish', rrestblob); + + setIsResetting(true); + } else { + rrestblob(); + setIsFirstTime(false); + } + } + }; + + function main() { + resetBlob(); + const interval = setTimeout(main, getRandomInt(7500, 30000)); + setMainInterval(interval); + }; + + useEffect(() => { + main(); + return () => { + if (mainInterval) { + clearTimeout(mainInterval); + } + }; + }, []); + + return ( + <div + id="blob" + className="blob" + ref={blobRef} + onClick={() => { + if (isResetting) { + return; + } + setIsResetting(true); + if (mainInterval) { + clearTimeout(mainInterval); + } + main(); + }} + /> + ); +}; + +function mouseBlob() { + // Implement the mouseBlob function + return <div>Mouse Blob</div>; +} + +export default function Blob({ blobtype: initialBlobType }: { blobtype?: string }) { + const [blobtype, setBlobtype] = useState<string | undefined>(initialBlobType); + const mainIntervalRef = useRef<NodeJS.Timeout | null>(null); + + useEffect(() => { + function main() { + if (mainIntervalRef.current) { + clearTimeout(mainIntervalRef.current); + } + mainIntervalRef.current = setTimeout(main, getRandomInt(7500, 30000)); + } + + main(); + + return () => { + if (mainIntervalRef.current) { + clearTimeout(mainIntervalRef.current); + } + }; + }, []); + + useEffect(() => { + if (blobtype === undefined) { + isMobile().then((isMobile) => { + setBlobtype(isMobile ? 'random' : 'mouse'); + }); + } else if (blobtype !== 'random' && blobtype !== 'mouse') { + throw new Error(`Invalid blob type ${blobtype}`); + } + }, [blobtype]); + + if (blobtype === undefined) { + return null; // or a loading spinner + } + + return blobtype === 'random' ? <RandomBlob /> : mouseBlob(); +}
\ No newline at end of file diff --git a/components/hacktype.tsx b/components/hacktype.tsx new file mode 100644 index 0000000..59c91b3 --- /dev/null +++ b/components/hacktype.tsx @@ -0,0 +1,55 @@ +"use client" + +import { useEffect, useRef } from "react"; + +const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +function hackType(element: HTMLElement) { + let iteration = 0; + const interval = setInterval(() => { + element.innerText = element.innerText + .split("") + .map((letter, index) => { + if (index < iteration) { + return element.getAttribute('data-value')![index]; + } + return letters[Math.floor(Math.random() * 26)]; + }) + .join(""); + + if (iteration >= element.getAttribute('data-value')!.length) { + clearInterval(interval); + } + + iteration += 1 / 5; + }, 20); +} + +export default function HackType({ text }: { text: string }) { + const elementRef = useRef<HTMLDivElement>(null); + + useEffect(() => { + if (elementRef.current) { + elementRef.current.setAttribute('data-value', text); + hackType(elementRef.current); + + const interval = setInterval(() => { + hackType(elementRef.current!); + }, 10000); + + document.addEventListener("visibilitychange", () => { + if (!document.hidden && elementRef.current) { + hackType(elementRef.current); + } + }); + + return () => clearInterval(interval); + } + }, [text]); + + return ( + <div ref={elementRef} className="hacktype"> + {text} + </div> + ); +}
\ No newline at end of file diff --git a/components/header.css b/components/header.css new file mode 100644 index 0000000..057ad90 --- /dev/null +++ b/components/header.css @@ -0,0 +1,123 @@ +header { + overflow: hidden; + position: fixed; + top: 2rem; + left: 0; + /* width: 75%; */ + /* width: 100%; */ + /* max-width: fit-content; */ + /* margin-left: 12.5%; */ + height: var(--topBarHeight); + /* justify-content: fit-content; */ + align-items: center; + text-align: center; + /* background: color(0, 0, 0, .1); */ + z-index: 1000; + /* background: rgba(0, 0, 0, 0.2); */ + background-color: #000; + border-radius: 32px; + transition: all 0.1s; + -webkit-user-select: none; /* Safari */ + -ms-user-select: none; /* IE 10 and IE 11 */ + user-select: none; /* Standard syntax */ +} + +.navBar a { + font-family: var(--font-jetbrains); + position: relative; + height: 100%; + text-align: center; + font-size: 2rem; + font-weight: 500; + text-transform: capitalize; + text-align: center; + text-decoration: none; + margin-left: 10mm; + margin-right: 10mm; + padding-top: 5mm; + /* padding-bottom: 3mm; */ + border-radius: 32px; + color: #F4E8C1; + transition: all .3s; + -webkit-user-select: none; /* Safari */ + -ms-user-select: none; /* IE 10 and IE 11 */ + user-select: none; /* Standard syntax */ +} + +.navBar .hleft a {float: left;} +.navBar .hright a {float: right;} + +.navBar a::after { + content: ''; + position: fixed; + left: 0; + bottom: 0; + width: 100%; + height: 1mm; + background: rgba(128, 128, 128, 0.2); + border-radius: 1mm; + transform: scaleX(0); + -webkit-transition: all 0.3s; + transition: all 0.3s; +} + +.navBar a:hover::after { + transform: scaleX(1.1); +} + +.navBar a:hover { + /* background: rgba(255, 255, 255, 0.2); */ + /* outline: ridge rgba(128, 128, 128, .6); */ + /* -webkit-backdrop-filter: blur(10px); + backdrop-filter: blur(10px); */ + -webkit-transition: all 1s; + transition: all 1s +} + +.navBar a.active::after { + content: ''; + position: absolute; + left: 0; + bottom: 0; + width: 100%; + height: 1mm; + background: rgba(128, 128, 128, .9); + border-radius: 1mm; + transform: scaleX(1); +} + +.navBar:active, +.navBar:hover, +header:hover, +#navBarHeader:hover +/* #navBarHeader:active */ +{ + transform: scale(1.005); + /* -webkit-backdrop-filter: blur(10px); + backdrop-filter: blur(10px); */ + transition: all 0.5s +} + +header:active, +#navBarHeader:active, +.navBar:active { + transform: scale(1.05); + /* transition: transform 700ms; */ +} + +.navBar, +header, +#navBarHeader { + /* -webkit-backdrop-filter: blur(2.5px); + backdrop-filter: blur(2.5px); */ + transition: all 0.5s +} + +header.minimizedIsland { + opacity: 0; + scale: 0; + -webkit-animation-name: minimizeIsland; + animation-name: minimizeIsland; + animation-fill-mode: forwards; + transition: all 0.3s +}
\ No newline at end of file diff --git a/components/header.tsx b/components/header.tsx new file mode 100644 index 0000000..5b850e2 --- /dev/null +++ b/components/header.tsx @@ -0,0 +1,39 @@ +"use client" + +import Link from "next/link" +import { usePathname } from "next/navigation" +import { cn } from "@/lib/utils" +import { useEffect, useState } from 'react'; +import "./header.css" + + +export default function Header() { + const pathname = usePathname() + const [isMinimized, setIsMinimized] = useState(false); + + useEffect(() => { + const handleScroll = () => { + setIsMinimized(window.scrollY > 100); + }; + + window.addEventListener('scroll', handleScroll); + + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + + return ( + <header id="navBarHeader" className={isMinimized ? "minimizedIsland" : ""}> + <nav className="navBar"> + <div className="hleft"> + <Link id="btnHome" className={pathname === "/" ? "active": ""} style={{ textDecoration: 'unset' }} href="/">Home</Link> + </div> + <div className="hright"> + <Link id="btnAbout" className={pathname === "/about" ? "active": ""} style={{ textDecoration: 'unset' }} href="/about">About</Link> + <Link id="btnGhRepo" className={pathname === "/ghrepos" ? "active": ""} style={{ textDecoration: 'unset' }} href="/ghrepos">Github Repos</Link> + </div> + </nav> + </header> + ) +}
\ No newline at end of file diff --git a/components/theme-provider.tsx b/components/theme-provider.tsx new file mode 100644 index 0000000..6d17554 --- /dev/null +++ b/components/theme-provider.tsx @@ -0,0 +1,9 @@ +"use client" + +import * as React from "react" +import { ThemeProvider as NextThemesProvider } from "next-themes" +import { type ThemeProviderProps } from "next-themes/dist/types" + +export function ThemeProvider({ children, ...props }: ThemeProviderProps) { + return <NextThemesProvider {...props}>{children}</NextThemesProvider> +} |
