fixed sidebar displaying bug
This commit is contained in:
@@ -22,8 +22,8 @@ const Sidebar: React.FC = () => {
|
|||||||
const sorted = [...items].sort((a, b) => Number(a.inSafe) - Number(b.inSafe));
|
const sorted = [...items].sort((a, b) => Number(a.inSafe) - Number(b.inSafe));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className="w-full md:w-72 md:h-[calc(100vh-2rem)] md:sticky md:top-4 overflow-y-auto rounded-2xl pt-0 px-3 pb-3 sm:pt-0 sm:px-4 sm:pb-4 bg-gradient-to-b from-white to-slate-50 ring-1 ring-slate-200/70 shadow-md">
|
<aside className="w-full md:w-72 md:h-full flex flex-col rounded-2xl pt-0 px-3 pb-3 sm:pt-0 sm:px-4 sm:pb-4 bg-gradient-to-b from-white to-slate-50 ring-1 ring-slate-200/70 shadow-md overflow-hidden">
|
||||||
<h2 className="sticky top-0 z-10 -mx-3 sm:-mx-4 px-3 sm:px-4 py-2.5 bg-white/85 backdrop-blur supports-[backdrop-filter]:backdrop-blur border-b border-slate-200/70 text-lg sm:text-xl font-bold mb-3 text-slate-900 tracking-tight flex items-center justify-between gap-2 rounded-t-2xl">
|
<div className="sticky top-0 z-10 -mx-3 sm:-mx-4 px-3 sm:px-4 py-2.5 bg-white/85 backdrop-blur supports-[backdrop-filter]:backdrop-blur border-b border-slate-200/70 text-lg sm:text-xl font-bold mb-3 text-slate-900 tracking-tight flex items-center justify-between gap-2 rounded-t-2xl">
|
||||||
<span className="flex items-center gap-2 min-w-0 flex-1 truncate">
|
<span className="flex items-center gap-2 min-w-0 flex-1 truncate">
|
||||||
<MonitorSmartphone className="w-5 h-5 text-slate-700 shrink-0" />
|
<MonitorSmartphone className="w-5 h-5 text-slate-700 shrink-0" />
|
||||||
<span className="truncate">Geräte</span>
|
<span className="truncate">Geräte</span>
|
||||||
@@ -33,9 +33,10 @@ const Sidebar: React.FC = () => {
|
|||||||
{outCount} außerhalb
|
{outCount} außerhalb
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</h2>
|
</div>
|
||||||
|
|
||||||
{/* Mobile: horizontal scroll, Desktop: vertical list */}
|
{/* Scroll area */}
|
||||||
|
<div className="flex-1 min-h-0 overflow-y-auto">
|
||||||
<div className="flex gap-3 overflow-x-auto snap-x snap-mandatory pb-2 -mr-1 pr-2 md:block md:space-y-3 md:pr-1 md:pb-1">
|
<div className="flex gap-3 overflow-x-auto snap-x snap-mandatory pb-2 -mr-1 pr-2 md:block md:space-y-3 md:pr-1 md:pb-1">
|
||||||
{sorted.map((item: any) => (
|
{sorted.map((item: any) => (
|
||||||
<div
|
<div
|
||||||
@@ -47,7 +48,10 @@ const Sidebar: React.FC = () => {
|
|||||||
} shrink-0 snap-start min-w-[240px] md:min-w-0`}
|
} shrink-0 snap-start min-w-[240px] md:min-w-0`}
|
||||||
>
|
>
|
||||||
<div className="flex items-start gap-3">
|
<div className="flex items-start gap-3">
|
||||||
<span className="relative mt-0.5 inline-flex" aria-hidden="true">
|
<span
|
||||||
|
className="relative mt-0.5 inline-flex"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
{!item.inSafe && (
|
{!item.inSafe && (
|
||||||
<span className="absolute inline-flex h-3 w-3 rounded-full bg-red-400 opacity-75 animate-ping"></span>
|
<span className="absolute inline-flex h-3 w-3 rounded-full bg-red-400 opacity-75 animate-ping"></span>
|
||||||
)}
|
)}
|
||||||
@@ -84,6 +88,7 @@ const Sidebar: React.FC = () => {
|
|||||||
Außerhalb des Schließfachs
|
Außerhalb des Schließfachs
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import React from "react";
|
import React, { useRef } from "react";
|
||||||
import "../App.css";
|
import "../App.css";
|
||||||
import Header from "../components/Header";
|
import Header from "../components/Header";
|
||||||
import Sidebar from "../components/Sidebar";
|
import Sidebar from "../components/Sidebar";
|
||||||
@@ -10,24 +10,24 @@ type LayoutProps = {
|
|||||||
|
|
||||||
const Layout: React.FC<LayoutProps> = ({ children, onLogout }) => {
|
const Layout: React.FC<LayoutProps> = ({ children, onLogout }) => {
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex bg-slate-50 text-slate-800">
|
<div className="h-screen overflow-hidden flex bg-slate-50 text-slate-800">
|
||||||
{/* Main */}
|
{/* Main */}
|
||||||
<main className="flex-1 flex flex-col items-center px-3 sm:px-5 py-4 sm:py-8">
|
<main className="flex-1 min-h-0 overflow-hidden flex flex-col items-center px-3 sm:px-5 py-4 sm:py-8">
|
||||||
{/* Sidebar on mobile appears inline on top; on desktop it's a sticky column */}
|
{/* Sidebar on mobile appears inline on top; on desktop it's a sticky column */}
|
||||||
<div className="w-full max-w-5xl md:flex md:gap-6">
|
<div className="w-full max-w-5xl md:flex md:gap-6 md:items-stretch md:min-h-0 md:h-full">
|
||||||
<div className="block md:hidden mb-3">
|
<div className="block md:hidden mb-3">
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="hidden md:block md:shrink-0 md:w-72">
|
<div className="hidden md:flex md:flex-col md:shrink-0 md:w-72 md:min-h-0 md:h-full">
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0 md:min-h-0 md:h-full flex flex-col overflow-hidden">
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Header onLogout={onLogout} />
|
<Header onLogout={onLogout} />
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full bg-white shadow-md md:shadow-lg rounded-2xl p-4 sm:p-6 ring-1 ring-slate-200">
|
<div className="w-full bg-white shadow-md md:shadow-lg rounded-2xl p-4 sm:p-6 ring-1 ring-slate-200 flex-1 min-h-0 overflow-y-auto">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user