workspace: panel-level responsiveness via CSS container queries
Panels are now container contexts (@container → container-type: inline-size) on both the normal and transparent PanelSlot render paths, so panel content can respond to the *panel's* width instead of only the viewport's. Non- breaking: existing screens keep their viewport (lg:/md:) variants untouched. First adopter: the bTop system-monitor grid reflows on panel drag — grid-cols-1 → 2 at @min-[600px] → 3 at @min-[960px] (panel width), keeping cards ≥300px so they no longer squeeze on a narrow panel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -86,7 +86,7 @@ export const BtopView = () => {
|
||||
|
||||
{stats && (
|
||||
<>
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
|
||||
<div className="grid grid-cols-1 gap-4 @min-[600px]:grid-cols-2 @min-[960px]:grid-cols-3">
|
||||
<Card title="CPU" icon={Cpu}>
|
||||
<div className="flex items-end justify-between">
|
||||
<span className="text-3xl font-semibold text-foreground">{stats.cpu.usagePct.toFixed(0)}%</span>
|
||||
|
||||
@@ -280,7 +280,7 @@ export const PanelSlot = ({ panel, registry, components, interactive, locked, no
|
||||
if (entry?.transparent) {
|
||||
return contextMenu(
|
||||
<div data-panel-id={panel.id} className="group/panel relative h-full w-full p-1">
|
||||
<div className="relative h-full w-full overflow-hidden">
|
||||
<div className="@container relative h-full w-full overflow-hidden">
|
||||
<AppComponent panelId={panel.id} />
|
||||
</div>
|
||||
{overlays}
|
||||
@@ -344,7 +344,7 @@ export const PanelSlot = ({ panel, registry, components, interactive, locked, no
|
||||
) : headerContent;
|
||||
|
||||
const body = (
|
||||
<div className="flex-1 min-h-0">
|
||||
<div className="@container flex-1 min-h-0">
|
||||
<Card className="h-full w-full overflow-hidden p-0 rounded-none border-0 shadow-none">
|
||||
<AppComponent panelId={panel.id} />
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user