Skip to content

Commit dc57afe

Browse files
committed
Fixed Close
X button appeared everywhere on the CLIWindows, added option onClose to only appear on those we want it to
1 parent 0d5246b commit dc57afe

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

programmerbar-web/src/lib/components/app/CLIWindow.svelte

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,28 @@
44
title: string;
55
children?: import('svelte').Snippet;
66
class?: string;
7+
onClose?: () => void;
78
};
89
9-
let { title, children, class: className = '' }: Props = $props();
10+
let { title, children, class: className = '', onClose }: Props = $props();
1011
</script>
1112

1213
<div class="border-border bg-card flex flex-col border-2 font-mono {className}">
1314
<!-- Window Title Bar -->
1415
<div class="border-border bg-card-muted flex items-center justify-between border-b px-3 py-1.5">
1516
<div class="flex items-center gap-2">
1617
<div class="flex shrink-0 gap-1.5">
17-
<button
18-
onclick={() => window.history.back()}
19-
class="bg-accent-error flex h-3 w-3 items-center justify-center rounded-full transition-opacity
20-
hover:opacity-80"
21-
aria-label="Close"
22-
>
23-
<X class="h-2 w-2 text-black" strokeWidth={3} />
24-
</button>
18+
{#if onClose}
19+
<button
20+
onclick={onClose}
21+
class="bg-accent-error flex h-3 w-3 items-center justify-center rounded-full transition-opacity hover:opacity-80"
22+
aria-label="Close"
23+
>
24+
<X class="h-2 w-2 text-black" strokeWidth={3} />
25+
</button>
26+
{:else}
27+
<div class="bg-accent-error h-3 w-3 rounded-full"></div>
28+
{/if}
2529
<div class="bg-accent-warning h-3 w-3 rounded-full"></div>
2630
<div class="bg-accent-success h-3 w-3 rounded-full"></div>
2731
</div>

programmerbar-web/src/routes/(app)/produkt/[id]/+page.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@
127127
type="product"
128128
/>
129129

130-
<CLIWindow title="cat produkt/{data.product._id}.txt" class="mx-auto w-full max-w-6xl">
130+
<CLIWindow
131+
title="cat produkt/{data.product._id}.txt"
132+
class="mx-auto w-full max-w-6xl"
133+
onClose={() => window.history.back()}
134+
>
131135
<!-- Window Content -->
132136
<div class="flex-1 p-6 md:p-8">
133137
<!-- Mobile Header - Only visible on mobile -->

0 commit comments

Comments
 (0)