Merge pull request 'ui/refine-sidebar-sidepane' (#5017) from ui/refine-sidebar-sidepane into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5017
This commit is contained in:
brianmcgee
2025-08-28 15:44:27 +00:00
8 changed files with 67 additions and 30 deletions

View File

@@ -1,7 +1,3 @@
.sidebar { .sidebar {
@apply w-60 border-none z-10; @apply w-60 border-none z-10 h-full flex flex-col;
.body {
@apply pt-4 pb-3 px-2;
}
} }

View File

@@ -2,6 +2,8 @@ import styles from "./Sidebar.module.css";
import { SidebarHeader } from "@/src/components/Sidebar/SidebarHeader"; import { SidebarHeader } from "@/src/components/Sidebar/SidebarHeader";
import { SidebarBody } from "@/src/components/Sidebar/SidebarBody"; import { SidebarBody } from "@/src/components/Sidebar/SidebarBody";
import cx from "classnames"; import cx from "classnames";
import { Show, splitProps } from "solid-js";
import { useMachineName } from "@/src/hooks/clan";
export interface LinkProps { export interface LinkProps {
path: string; path: string;
@@ -19,10 +21,12 @@ export interface SidebarProps {
} }
export const Sidebar = (props: SidebarProps) => { export const Sidebar = (props: SidebarProps) => {
const [bodyProps] = splitProps(props, ["staticSections"]);
return ( return (
<div class={cx(styles.sidebar, props.class)}> <div class={cx(styles.sidebar, props.class)}>
<SidebarHeader /> <SidebarHeader />
<SidebarBody class={cx(styles.body)} {...props} /> <SidebarBody {...bodyProps} />
</div> </div>
); );
}; };

View File

@@ -1,10 +1,10 @@
div.sidebar-pane { div.sidebar-pane {
@apply border-none z-10; @apply flex flex-col border-none z-20 h-full;
animation: sidebarPaneShow 250ms ease-in forwards; animation: sidebarPaneShow 250ms ease-in forwards;
&.open { &.open {
@apply w-60; @apply w-72;
} }
&.closing { &.closing {
@@ -90,7 +90,7 @@ div.sidebar-pane {
@apply opacity-100; @apply opacity-100;
} }
100% { 100% {
@apply w-60; @apply w-72;
} }
} }

View File

@@ -1,5 +1,5 @@
div.sidebar-section { div.sidebar-section {
@apply flex flex-col gap-2 w-full h-fit; @apply flex flex-col gap-2 w-full h-full;
& > div.header { & > div.header {
@apply flex items-center justify-between px-1.5; @apply flex items-center justify-between px-1.5;

View File

@@ -7,9 +7,38 @@
@apply min-w-96; @apply min-w-96;
} }
.sidebar { .sidebarContainer {
@apply absolute left-4 top-[2.25rem] w-60; @apply absolute left-4 top-4 w-60 z-10;
@apply min-h-96; height: calc(100vh - 2rem);
height: calc(100vh - 7.5rem); animation: sidebarNoMachine 250ms ease-in-out;
&.machineSelected {
@apply top-16;
height: calc(100vh - 8rem);
animation: sidebarMachine 250ms ease-in-out;
}
}
@keyframes sidebarNoMachine {
0% {
@apply top-16;
height: calc(100vh - 8rem);
}
100% {
@apply top-4;
height: calc(100vh - 2rem);
}
}
@keyframes sidebarMachine {
0% {
@apply top-4;
height: calc(100vh - 2rem);
}
100% {
@apply top-16;
height: calc(100vh - 8rem);
}
} }

View File

@@ -14,6 +14,7 @@ import {
buildMachinePath, buildMachinePath,
maybeUseMachineName, maybeUseMachineName,
useClanURI, useClanURI,
useMachineName,
} from "@/src/hooks/clan"; } from "@/src/hooks/clan";
import { CubeScene } from "@/src/scene/cubes"; import { CubeScene } from "@/src/scene/cubes";
import { import {
@@ -119,7 +120,13 @@ export const Clan: Component<RouteSectionProps> = (props) => {
) )
} }
> >
<Sidebar class={cx(styles.sidebar)} /> <div
class={cx(styles.sidebarContainer, {
[styles.machineSelected]: useMachineName(),
})}
>
<Sidebar />
</div>
{props.children} {props.children}
<ClanSceneController {...props} /> <ClanSceneController {...props} />
</ClanContext.Provider> </ClanContext.Provider>

View File

@@ -1,5 +1,5 @@
.sidebarPane { .sidebarPaneContainer {
@apply absolute left-[16.5rem] top-[5.5rem] w-64; @apply absolute left-[16.5rem] top-4 w-64 z-20;
height: calc(100vh - 14.5rem); height: calc(100vh - 2rem);
} }

View File

@@ -52,8 +52,8 @@ export const Machine = (props: RouteSectionProps) => {
const sectionProps = { clanURI, machineName, onSubmit, machineQuery }; const sectionProps = { clanURI, machineName, onSubmit, machineQuery };
return ( return (
<div class={styles.sidebarPaneContainer}>
<SidebarPane <SidebarPane
class={cx(styles.sidebarPane)}
title={machineName} title={machineName}
onClose={onClose} onClose={onClose}
subHeader={() => ( subHeader={() => (
@@ -64,6 +64,7 @@ export const Machine = (props: RouteSectionProps) => {
<SectionGeneral {...sectionProps} /> <SectionGeneral {...sectionProps} />
<SectionTags {...sectionProps} /> <SectionTags {...sectionProps} />
</SidebarPane> </SidebarPane>
</div>
); );
}; };