diff --git a/packages/ui-components/src/Containers/Article/index.module.css b/packages/ui-components/src/Containers/Article/index.module.css index c4d541d9fb19f..2bb807088f5e2 100644 --- a/packages/ui-components/src/Containers/Article/index.module.css +++ b/packages/ui-components/src/Containers/Article/index.module.css @@ -3,16 +3,15 @@ .articleLayout { @apply max-w-10xl ml:grid - ml:grid-cols-[--spacing(52)_1fr] + ml:grid-cols-[auto_1fr] ml:grid-rows-[1fr] ml:overflow-visible ml:[grid-template-areas:'sidebar_main''sidebar_footer'] mx-auto block w-full - xl:grid-cols-[--spacing(52)_1fr_--spacing(52)] - xl:[grid-template-areas:'sidebar_main_metabar''sidebar_footer_metabar'] - 2xl:grid-cols-[--spacing(80)_1fr_--spacing(80)]; + xl:grid-cols-[auto_1fr_auto] + xl:[grid-template-areas:'sidebar_main_metabar''sidebar_footer_metabar']; > *:nth-child(1) { @apply [grid-area:sidebar] diff --git a/packages/ui-components/src/Containers/Sidebar/index.module.css b/packages/ui-components/src/Containers/Sidebar/index.module.css index f129b31b576de..11fc88111c3ad 100644 --- a/packages/ui-components/src/Containers/Sidebar/index.module.css +++ b/packages/ui-components/src/Containers/Sidebar/index.module.css @@ -1,32 +1,73 @@ @reference "../../styles/index.css"; .wrapper { - @apply scrollbar-thin - ml:max-w-xs - ml:overflow-auto - ml:border-r + @apply ml:border-r + ml:overflow-visible! + ml:max-w-[clamp(200px,20vw,320px)] + relative z-0 flex w-full flex-col - gap-8 border-r-0 border-neutral-200 bg-white - px-4 - py-6 - 2xl:px-6 + transition-[transform,width] + duration-220 + ease-out dark:border-neutral-900 dark:bg-neutral-950; - .navigation { - @apply ml:flex - hidden; - } + &[data-collapsed='true'] { + @apply ml:w-0 + overflow-hidden; - .mobileSelect { - @apply ml:hidden - flex - w-full; + .content { + @apply invisible; + } } } + +.content { + @apply scrollbar-thin + flex + h-full + flex-col + gap-8 + overflow-y-auto + px-4 + py-6 + 2xl:min-w-80 + 2xl:px-6; +} + +.navigation { + @apply ml:flex + hidden; +} + +.mobileSelect { + @apply ml:hidden + flex + w-full; +} + +.toggleButton { + @apply absolute + top-1/2 + left-full + z-50 + flex + h-12 + w-6 + -translate-y-1/2 + cursor-pointer + items-center + justify-center + bg-green-600 + text-white + outline-none + max-xl:hidden; + + clip-path: polygon(0 0, 100% 25%, 100% 75%, 0 100%); +} diff --git a/packages/ui-components/src/Containers/Sidebar/index.tsx b/packages/ui-components/src/Containers/Sidebar/index.tsx index b41c83e1630da..95770d5d283b5 100644 --- a/packages/ui-components/src/Containers/Sidebar/index.tsx +++ b/packages/ui-components/src/Containers/Sidebar/index.tsx @@ -1,4 +1,7 @@ -import { forwardRef } from 'react'; +'use client'; + +import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/solid'; +import { forwardRef, useState } from 'react'; import WithNoScriptSelect from '#ui/Common/Select/NoScriptSelect'; import SidebarGroup from '#ui/Containers/Sidebar/SidebarGroup'; @@ -21,6 +24,8 @@ type SidebarProps = { const SideBar = forwardRef>( ({ groups, pathname, title, onSelect, as, children, placeholder }, ref) => { + const [isOpen, setIsOpen] = useState(true); + const selectItems = groups.map(({ items, groupName }) => ({ label: groupName, items: items.map(({ label, link }) => ({ value: link, label })), @@ -31,31 +36,46 @@ const SideBar = forwardRef>( .find(item => pathname === item.value); return ( -