feat(ui): reduce size of sidebar when selecting a machine

This commit is contained in:
Brian McGee
2025-08-28 16:12:11 +01:00
parent 0cc9b91ae8
commit 92eb27fcb1
7 changed files with 59 additions and 21 deletions

View File

@@ -2,7 +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 { splitProps } from "solid-js"; import { Show, splitProps } from "solid-js";
import { useMachineName } from "@/src/hooks/clan";
export interface LinkProps { export interface LinkProps {
path: string; path: string;

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

@@ -10,4 +10,35 @@
.sidebarContainer { .sidebarContainer {
@apply absolute left-4 top-4 w-60 z-10; @apply absolute left-4 top-4 w-60 z-10;
height: calc(100vh - 2rem); height: calc(100vh - 2rem);
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,11 @@ export const Clan: Component<RouteSectionProps> = (props) => {
) )
} }
> >
<div class={styles.sidebarContainer}> <div
class={cx(styles.sidebarContainer, {
[styles.machineSelected]: useMachineName(),
})}
>
<Sidebar /> <Sidebar />
</div> </div>
{props.children} {props.children}

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,18 +52,19 @@ export const Machine = (props: RouteSectionProps) => {
const sectionProps = { clanURI, machineName, onSubmit, machineQuery }; const sectionProps = { clanURI, machineName, onSubmit, machineQuery };
return ( return (
<SidebarPane <div class={styles.sidebarPaneContainer}>
class={cx(styles.sidebarPane)} <SidebarPane
title={machineName} title={machineName}
onClose={onClose} onClose={onClose}
subHeader={() => ( subHeader={() => (
<SidebarMachineStatus clanURI={clanURI} machineName={machineName} /> <SidebarMachineStatus clanURI={clanURI} machineName={machineName} />
)} )}
> >
<SidebarSectionInstall clanURI={clanURI} machineName={machineName} /> <SidebarSectionInstall clanURI={clanURI} machineName={machineName} />
<SectionGeneral {...sectionProps} /> <SectionGeneral {...sectionProps} />
<SectionTags {...sectionProps} /> <SectionTags {...sectionProps} />
</SidebarPane> </SidebarPane>
</div>
); );
}; };