diff --git a/src/app/globals.css b/src/app/globals.css index 0055f51..fa281e9 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -2,6 +2,7 @@ @import "tw-animate-css"; @import "tailwindcss-safe-area"; @custom-variant dark (&:is(.dark *)); +@custom-variant adjust (&:where([data-adjust="true"] *)); @theme inline { --color-background: var(--background); diff --git a/src/app/page.tsx b/src/app/page.tsx index 2131de8..2591e44 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -34,6 +34,7 @@ import StaticSidebarTrigger from "@/components/static-sidebar-trigger"; import SidebarTriggerAdjustable from "@/components/sidebar-trigger-adjustable"; import ScrollFadingTitle from "@/components/scroll-fading-title"; import { fa } from "zod/v4/locales"; +import AscendingCard from "@/components/ascending-card"; type SortingType = "byCreationDate" | "byEditDate" @@ -412,7 +413,7 @@ const ProjectContainer = ({ return ( - +
@@ -430,7 +431,7 @@ const ProjectContainer = ({ handleCheck} />
)} - + ) }; diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 0c43dfa..de38f08 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { SidebarTrigger } from "@/components/ui/sidebar"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; -import { ChartPieIcon, InfoIcon } from "lucide-react"; +import { ChartPieIcon, ChevronRightIcon, InfoIcon } from "lucide-react"; import { ReactNode, useEffect, useState } from "react"; import { usePersistenceContext } from "../persistence-provider"; import StaticSidebarTrigger from "@/components/static-sidebar-trigger"; @@ -14,12 +14,12 @@ import { useIsMobile } from "@/hooks/use-mobile"; import { cn } from "@/lib/utils"; import AscendingCard from "@/components/ascending-card"; import Link from "next/link"; +import WideAscendingCard from "@/components/wide-container"; +import WideContainer from "@/components/wide-container"; export default function Settings(): ReactNode { const isMobile = useIsMobile(); - const cardWidth = isMobile ? "w-full" : "w-2xl"; - return (
@@ -29,22 +29,29 @@ export default function Settings(): ReactNode {
- - + + + +
-
- - -
- -
-
-

Storage

-

Memory usage, media, cache etc.

-
-
- +
+ + + +
+
+ +
+
+

Storage

+

Memory usage, media, cache etc.

+
+
+ +
+ +
); diff --git a/src/app/settings/storage/page.tsx b/src/app/settings/storage/page.tsx index f410919..a5511c9 100644 --- a/src/app/settings/storage/page.tsx +++ b/src/app/settings/storage/page.tsx @@ -1,11 +1,13 @@ "use client"; import { usePersistenceContext } from "@/app/persistence-provider"; +import AscendingCard from "@/components/ascending-card"; import ScrollFadingTitle from "@/components/scroll-fading-title"; import Search from "@/components/search"; import SidebarTriggerAdjustable from "@/components/sidebar-trigger-adjustable"; import StaticSidebarTrigger from "@/components/static-sidebar-trigger"; import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; +import WideContainer from "@/components/wide-container"; import { useIsMobile } from "@/hooks/use-mobile"; import { cn } from "@/lib/utils"; import { ArrowLeftIcon } from "lucide-react"; @@ -33,8 +35,6 @@ export default function Storage() { setStatus(localStorage.getItem("persistence-status")); }, []); - const cardWidth = isMobile ? "w-full" : "w-2xl"; - return (
@@ -49,15 +49,21 @@ export default function Storage() {
- - + + + +
-
-
- -
- +
+ + +
+ +
+ +
+
) diff --git a/src/components/search/Search.tsx b/src/components/search/Search.tsx index 4580211..5d4900b 100644 --- a/src/components/search/Search.tsx +++ b/src/components/search/Search.tsx @@ -7,6 +7,7 @@ import { cn } from "@/lib/utils"; export const Search = (props: ComponentProps): ReactNode => (
( @@ -11,41 +9,32 @@ const easeSlide = (x: number) => ( const lerp = (a: number, b: number, t: number) => ( a * t + b * (1 - t) ); -const cssLerp = (a: string, b: string, t: string) => ( - `${a} * ${t} + ${b} * (1 - ${t})` -); export const SidebarTriggerAdjustable = (props: ComponentProps<"div"> & { - adjustWidth?: number | `${number}`; + adjustWidth?: number | `${number}` }) => { - const adjustWidth = props.adjustWidth ? +props.adjustWidth : 12; + const adjustWidth = props.adjustWidth === undefined ? 12 : +props.adjustWidth; const isMobile = useIsMobile(); + const [slideAmount, setSlideAmount] = useState(0); useEffect(() => { - const triggerElement = document.querySelector('div[data-sidebar-trigger="true"]'); - - const handleScroll = () => { - if (!triggerElement) { - console.log("triggerElement is null"); - return; - } - const triggerDiv = triggerElement as HTMLDivElement; - const slideAmount = easeSlide( + const handleScroll = () => + setSlideAmount(easeSlide( Math.max(0, Math.min(1, window.scrollY / (window.innerHeight / 20))) - ); - triggerDiv.style.transform = `translateX(calc(var(--spacing) * ${adjustWidth * slideAmount}))`; - triggerDiv.style.paddingTop = `calc(var(--spacing) * ${(isMobile ? 1 : 3) * slideAmount})`; - triggerDiv.style.width = `calc(100% - var(--spacing) * ${lerp(0, adjustWidth, 1 - slideAmount)})`; - }; + )); handleScroll(); - window.addEventListener('scroll', handleScroll, {passive: true}); + window.addEventListener('scroll', handleScroll, { passive: true }); return () => { window.removeEventListener('scroll', handleScroll); }; }, [isMobile]); - return
{props.children}
; + return
{props.children}
; } \ No newline at end of file diff --git a/src/components/wide-container/WideContainer.tsx b/src/components/wide-container/WideContainer.tsx new file mode 100644 index 0000000..c60643e --- /dev/null +++ b/src/components/wide-container/WideContainer.tsx @@ -0,0 +1,12 @@ +import { ComponentProps } from "react"; +import { useIsMobile } from "@/hooks/use-mobile"; +import { cn } from "@/lib/utils"; + +export const WideContainer = (props: ComponentProps<"div">) => { + const isMobile = useIsMobile(); + const cardWidth = "max-w-2xl w-full md:w-85 lg:w-130 xl:w-2xl"; + + return ( +
+ ); +}; \ No newline at end of file diff --git a/src/components/wide-container/index.ts b/src/components/wide-container/index.ts new file mode 100644 index 0000000..25f05b9 --- /dev/null +++ b/src/components/wide-container/index.ts @@ -0,0 +1,3 @@ +import { WideContainer } from "./WideContainer"; + +export default WideContainer; \ No newline at end of file