diff --git a/src/app/layout.tsx b/src/app/layout.tsx index c58a68a..8293abd 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -48,7 +48,7 @@ export default async function RootLayout({ -
+
{children} diff --git a/src/app/page.tsx b/src/app/page.tsx index f3abd7d..14c0414 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -30,6 +30,8 @@ import { Tooltip, TooltipContent } from "@/components/ui/tooltip"; import { TooltipTrigger } from "@radix-ui/react-tooltip"; import { Sheet, SheetClose, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"; import { Separator } from "@/components/ui/separator"; +import StaticSidebarTrigger from "@/components/static-sidebar-trigger"; +import SidebarTriggerAdjustable from "@/components/sidebar-trigger-adjustable"; type SortingType = "byCreationDate" | "byEditDate" @@ -331,7 +333,7 @@ const ProjectDropdown = ({ ); }; -const ProjectDescription = ({ project }: { project: Project}): ReactNode => { +const ProjectDescription = ({ project }: { project: Project }): ReactNode => { const isMobile = useIsMobile(); if (!project.description) return <>; @@ -348,7 +350,7 @@ const ProjectDescription = ({ project }: { project: Project}): ReactNode => { {project.title} Description Additional Information About the Project - +
{project.description}
@@ -417,7 +419,7 @@ const ProjectContainer = ({ return ( -
+

{project.title}

@@ -425,7 +427,7 @@ const ProjectContainer = ({ {project.editDate &&

Last Edit Date: {date.toLocaleDateString()}, {date.toLocaleTimeString()}

}
- {!selecting && } + {!selecting && }
@@ -488,44 +490,46 @@ export default function Home(): ReactNode {
- +

Project Library

{projects && }
-
-
- - - - - - - - Create New Project - - - Fill in the information about your project. You can change it at any time later. - - -
- - - - - - - - - - - - -
-
- setSearch(e.target.value)} className={isMobile ? "w-full" : "w-60"} /> -
+
+ +
+ + + + + + + + Create New Project + + + Fill in the information about your project. You can change it at any time later. + + +
+ + + + + + + + + + + + +
+
+ setSearch(e.target.value)} className={isMobile ? "w-full" : "w-60"} /> +
+
diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 3494264..2605396 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -6,6 +6,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip import { InfoIcon } from "lucide-react"; import { ReactNode, useEffect, useState } from "react"; import { usePersistenceContext } from "../persistence-provider"; +import StaticSidebarTrigger from "@/components/static-sidebar-trigger"; function PersistentStorageControl({ status @@ -29,7 +30,7 @@ export default function Settings(): ReactNode { return (
- +

Settings

diff --git a/src/components/sidebar-trigger-adjustable/SidebarTriggerAdjustable.tsx b/src/components/sidebar-trigger-adjustable/SidebarTriggerAdjustable.tsx new file mode 100644 index 0000000..f8677b3 --- /dev/null +++ b/src/components/sidebar-trigger-adjustable/SidebarTriggerAdjustable.tsx @@ -0,0 +1,37 @@ +"use client"; +import { useIsMobile } from "@/hooks/use-mobile"; +import { cn } from "@/lib/utils"; +import { ComponentProps, useEffect, useState } from "react"; + +const easeSlide = (x: number) => ( + 1 - Math.pow(1 - x, 2) +); + +export const SidebarTriggerAdjustable = (props: ComponentProps<"div">) => { + const [scrollY, setScrollY] = useState(0); + const [windowHeight, setWindowHeight] = useState(1); + const isMobile = useIsMobile(); + + useEffect(() => { + const handleScroll = () => setScrollY(window.scrollY); + const handleResize = () => setWindowHeight(window.innerHeight); + + setWindowHeight(window.innerHeight); + + window.addEventListener('scroll', handleScroll); + window.addEventListener('resize', handleResize); + + return () => { + window.removeEventListener('scroll', handleScroll); + window.removeEventListener('resize', handleResize); + }; + }, []); + + let slideAmount = Math.max(0, Math.min(1, scrollY / (windowHeight / 20))); + slideAmount = easeSlide(slideAmount); + + return
; +} \ No newline at end of file diff --git a/src/components/sidebar-trigger-adjustable/index.ts b/src/components/sidebar-trigger-adjustable/index.ts new file mode 100644 index 0000000..907d1d9 --- /dev/null +++ b/src/components/sidebar-trigger-adjustable/index.ts @@ -0,0 +1,3 @@ +import { SidebarTriggerAdjustable } from "./SidebarTriggerAdjustable"; + +export default SidebarTriggerAdjustable; \ No newline at end of file diff --git a/src/components/static-sidebar-trigger/StaticSidebarTrigger.tsx b/src/components/static-sidebar-trigger/StaticSidebarTrigger.tsx new file mode 100644 index 0000000..10a18d2 --- /dev/null +++ b/src/components/static-sidebar-trigger/StaticSidebarTrigger.tsx @@ -0,0 +1,15 @@ +"use client"; +import { useEffect, useState } from "react"; +import { SidebarTrigger, useSidebar } from "../ui/sidebar"; + +export const StaticSidebarTrigger = () => { + + return ( + <> +
+
+ +
+ + ); +}; \ No newline at end of file diff --git a/src/components/static-sidebar-trigger/index.ts b/src/components/static-sidebar-trigger/index.ts new file mode 100644 index 0000000..e1da636 --- /dev/null +++ b/src/components/static-sidebar-trigger/index.ts @@ -0,0 +1,3 @@ +import { StaticSidebarTrigger } from "./StaticSidebarTrigger"; + +export default StaticSidebarTrigger; \ No newline at end of file