Window system

This commit is contained in:
Nomi Nonsense (Nonszy) 2025-09-02 06:41:17 +07:00
parent a711d23ddc
commit 5f5a07cf41
7 changed files with 149 additions and 26 deletions

View File

@ -13,11 +13,23 @@
animation-timing-function: linear(0.2, 0.8, 1);
}
50% {
transform: translate(0px, -280px) scale(1.18, 0.9);
transform: translate(0px, -180px) scale(1.18, 0.9);
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
}
}
@keyframes window-popup {
0% {
transform: scale(0, 0.03);
}
40% {
transform: scale(1, 0.03);
}
100% {
transform: scale(1, 1);
}
}
h2 {
@apply text-2xl font-bold
}

View File

@ -5,9 +5,10 @@ import HomeText from "@/components/home-text.mdx"
import Link from "next/link";
import { FakeWindow } from "@/components/windows";
import Taskbar from "@/components/taskbar";
export default function Home() {
return (
return (<>
<main className="flex items-center pt-16 md:pt-24 pb-12 px-8 md:px-0">
<FakeWindow windowText="Homepage">
<header className="text-center mb-8">
@ -34,5 +35,5 @@ export default function Home() {
</footer>
</FakeWindow>
</main>
);
</>);
}

View File

@ -0,0 +1,81 @@
'use client'
import { Icon } from "@iconify/react";
import clsx from "clsx";
import { useState, useRef } from "react";
export const FakeRelativeWindow = ({
windowText, className, draggable, children
}: {
windowText: string,
className?: string,
draggable?: boolean
children: React.ReactNode
}) => {
const [isMinimized, setMinimize] = useState(false);
const [offset, setOffset] = useState({ x: 0, y: 0 });
const popupRef = useRef<HTMLDivElement>(null);
const pos = useRef({
dragging: false,
mouseX: 0,
mouseY: 0,
x: 0,
y: 0
});
const toggleMinimize = () => setMinimize(!isMinimized);
const onMouseDown = (e: React.MouseEvent) => {
if (popupRef.current) {
pos.current.dragging = true;
pos.current.mouseX = e.clientX;
pos.current.mouseY = e.clientY;
pos.current.x = offset.x;
pos.current.y = offset.y;
document.body.style.userSelect = "none";
}
window.addEventListener("mousemove", onMouseMove);
window.addEventListener("mouseup", onMouseUp);
};
const onMouseUp = () => {
pos.current.dragging = false;
document.body.style.userSelect = "";
window.removeEventListener("mousemove", onMouseMove);
window.removeEventListener("mouseup", onMouseUp);
};
const onMouseMove = (e: MouseEvent) => {
if (pos.current.dragging && popupRef.current) {
const dx = e.clientX - pos.current.mouseX;
const dy = e.clientY - pos.current.mouseY;
const newX = pos.current.x + dx;
const newY = pos.current.y + dy;
popupRef.current.style.transform = `translate(${newX}px, ${newY}px)`;
setOffset({ x: newX, y: newY });
}
};
return (
<div className={clsx("absolute", className)}>
<div className="mx-auto md:border bg-background border-primary animate-window-popup" ref={popupRef}>
<div
className="hidden md:flex bg-primary p-2 justify-between text-background windowbar"
onMouseDown={onMouseDown}
>
<div className="ms-1 pointer-events-none">
{windowText}
</div>
<div className="flex gap-2">
<button className="bg-primary border border-[#FFA826] border-outset p-1" onClick={toggleMinimize}><Icon icon="lucide:minus"/></button>
</div>
</div>
<div className={clsx("m-1 border border-primary", isMinimized ? "h-0 overflow-y-clip" : "h-fit")}>
<div className={"md:p-4 animate-[fade-in-half_1s]"}>
{children}
</div>
</div>
</div>
</div>
)
}

View File

@ -1,6 +1,7 @@
import Image from "next/image"
import Link from "next/link";
import { FloatingLabel } from "./floating-label";
import { FakeRelativeWindow } from "./client-windows";
Welcome!
@ -9,17 +10,19 @@ This is our cozy little corner of the internet where we run a bunch of services
We've got tools and resources for us but some we provide it for you, stuff that just works and doesn't burn our wallet.
<div className="relative">
<Link href="https://x.com/JoelGuerraC/status/1287088236171603969/photo/1" target="_blank">
<Image
className="hidden lg:inline-block absolute -left-96 -bottom-32 animate-silly-bouncing"
alt="Nola"
src="/images/coral-a1.png"
width={200}
height={200}
quality={10}
unoptimized
/>
</Link>
<FakeRelativeWindow windowText="Boing-boing" className='hidden lg:inline-block absolute -left-96 -bottom-32'>
<Link href="https://x.com/JoelGuerraC/status/1287088236171603969/photo/1" target="_blank">
<Image
className="animate-silly-bouncing"
alt="Nola"
src="/images/coral-a1.png"
width={200}
height={200}
quality={10}
unoptimized
/>
</Link>
</FakeRelativeWindow>
</div>
## About Me
@ -60,16 +63,18 @@ We aspire to blend creativity and technical mastery to shape products that empow
- Integrate artificial intelligence into digital products, creating smart, helpful, and engaging features that elevate the overall value and interactivity of applications.
<div className="relative">
<FloatingLabel placeholder="This is Nola, my OC :3">
<Image
className="hidden lg:inline-block absolute -right-96"
alt="Nola"
src="/images/nola.png"
width={250}
height={250}
unoptimized
/>
</FloatingLabel>
<FakeRelativeWindow draggable windowText="nola.png" className='hidden lg:inline-block -right-[120%]'>
<FloatingLabel placeholder="This is Nola, my OC :3">
<Image
className=""
alt="Nola"
src="/images/nola.png"
width={250}
height={250}
unoptimized
/>
</FloatingLabel>
</FakeRelativeWindow>
</div>
## Why Nonsense

View File

@ -37,12 +37,11 @@ export const Sosmed = () => {
return (
<div className="flex justify-center gap-4 mb-10">
{sosmeds.map((sosmed) => (
<FloatingLabel placeholder={sosmed.name}>
<FloatingLabel key={sosmed.name} placeholder={sosmed.name}>
<Link
className="grid items-center justify-center border border-primary w-[48px] xs:w-[54px] h-auto aspect-square transition-[transform] duration-75 hover:-translate-y-1 hover:scale-105"
href={sosmed.url}
target="_blank"
key={sosmed.name}
>
<Icon icon={sosmed.icon} className={`text-primary text-4xl ${sosmed.size}`} />
</Link>

View File

@ -0,0 +1,18 @@
'use client'
const Taskbar = () => {
return (
<div className="fixed bg-background p-2 border-t border-primary bottom-0 left-0 w-screen inline-flex gap-3 items-center">
<div className="px-4 font-bold">
NolaOS
</div>
<div className="flex gap-2">
<button className="border border-primary px-3 py-2">
Vision & Mission
</button>
</div>
</div>
)
}
export default Taskbar;

View File

@ -24,6 +24,13 @@ const config: Config = {
},
animation: {
"silly-bouncing": 'silly-bounce 0.8s infinite',
'window-popup': 'window-popup 1s'
},
keyframes: {
"fade-in-half": {
'0%, 50%': { opacity: "0" },
'100%': { opacity: '1' },
}
}
},
plugins: [],