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 {
@apply w-60 border-none z-10;
.body {
@apply pt-4 pb-3 px-2;
}
@apply w-60 border-none z-10 h-full flex flex-col;
}

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
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 {
@apply flex items-center justify-between px-1.5;

View File

@@ -7,9 +7,38 @@
@apply min-w-96;
}
.sidebar {
@apply absolute left-4 top-[2.25rem] w-60;
@apply min-h-96;
.sidebarContainer {
@apply absolute left-4 top-4 w-60 z-10;
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,
maybeUseMachineName,
useClanURI,
useMachineName,
} from "@/src/hooks/clan";
import { CubeScene } from "@/src/scene/cubes";
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}
<ClanSceneController {...props} />
</ClanContext.Provider>

View File

@@ -1,5 +1,5 @@
.sidebarPane {
@apply absolute left-[16.5rem] top-[5.5rem] w-64;
.sidebarPaneContainer {
@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 };
return (
<SidebarPane
class={cx(styles.sidebarPane)}
title={machineName}
onClose={onClose}
subHeader={() => (
<SidebarMachineStatus clanURI={clanURI} machineName={machineName} />
)}
>
<SidebarSectionInstall clanURI={clanURI} machineName={machineName} />
<SectionGeneral {...sectionProps} />
<SectionTags {...sectionProps} />
</SidebarPane>
<div class={styles.sidebarPaneContainer}>
<SidebarPane
title={machineName}
onClose={onClose}
subHeader={() => (
<SidebarMachineStatus clanURI={clanURI} machineName={machineName} />
)}
>
<SidebarSectionInstall clanURI={clanURI} machineName={machineName} />
<SectionGeneral {...sectionProps} />
<SectionTags {...sectionProps} />
</SidebarPane>
</div>
);
};