@olwiba/ui 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/app/AppShell.tsx +10 -2
- package/src/components/ThemeSwitchMinimal.tsx +6 -1
package/package.json
CHANGED
package/src/app/AppShell.tsx
CHANGED
|
@@ -87,6 +87,8 @@ export interface AppShellProps {
|
|
|
87
87
|
user?: AppShellUser;
|
|
88
88
|
/** Text shown in the top header bar */
|
|
89
89
|
pageTitle?: string;
|
|
90
|
+
/** Slot rendered at the start of the top header bar, after the sidebar trigger. */
|
|
91
|
+
headerStart?: ReactNode;
|
|
90
92
|
/** Override link rendering for SPA navigation. Defaults to a native <a>. */
|
|
91
93
|
renderLink?: AppShellRenderLink;
|
|
92
94
|
children?: ReactNode;
|
|
@@ -287,11 +289,16 @@ function ShellSidebar({
|
|
|
287
289
|
);
|
|
288
290
|
}
|
|
289
291
|
|
|
290
|
-
function ShellHeader({ pageTitle }: { pageTitle: string }) {
|
|
292
|
+
function ShellHeader({ pageTitle, headerStart }: { pageTitle: string; headerStart?: ReactNode }) {
|
|
291
293
|
return (
|
|
292
294
|
<header className="flex h-12 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12">
|
|
293
295
|
<div className="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6">
|
|
294
296
|
<SidebarTrigger className="-ml-1" />
|
|
297
|
+
{headerStart && (
|
|
298
|
+
<div className="flex items-center gap-1">
|
|
299
|
+
{headerStart}
|
|
300
|
+
</div>
|
|
301
|
+
)}
|
|
295
302
|
<Separator orientation="vertical" className="mx-2 data-[orientation=vertical]:h-4" />
|
|
296
303
|
<h1 className="text-base font-medium">{pageTitle}</h1>
|
|
297
304
|
</div>
|
|
@@ -323,6 +330,7 @@ export function AppShell({
|
|
|
323
330
|
action,
|
|
324
331
|
user = defaultUser,
|
|
325
332
|
pageTitle = 'Dashboard',
|
|
333
|
+
headerStart,
|
|
326
334
|
renderLink = defaultRenderLink,
|
|
327
335
|
collapsible = 'icon',
|
|
328
336
|
sidebarPosition = 'viewport',
|
|
@@ -347,7 +355,7 @@ export function AppShell({
|
|
|
347
355
|
sidebarPosition={sidebarPosition}
|
|
348
356
|
/>
|
|
349
357
|
<SidebarInset className={isContained ? undefined : 'overflow-y-auto'}>
|
|
350
|
-
<ShellHeader pageTitle={pageTitle} />
|
|
358
|
+
<ShellHeader pageTitle={pageTitle} headerStart={headerStart} />
|
|
351
359
|
{children}
|
|
352
360
|
</SidebarInset>
|
|
353
361
|
</SidebarProvider>
|
|
@@ -22,7 +22,12 @@ export function ThemeSwitchMinimal() {
|
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<Button variant="ghost" size="icon" onClick={toggle} className="size-8" aria-label="Toggle theme">
|
|
25
|
-
|
|
25
|
+
<span
|
|
26
|
+
key={theme}
|
|
27
|
+
className="inline-flex size-4 items-center justify-center animate-in fade-in zoom-in-75 spin-in-90 duration-200 motion-reduce:animate-none"
|
|
28
|
+
>
|
|
29
|
+
{theme === 'dark' ? <Sun className="size-4" /> : <Moon className="size-4" />}
|
|
30
|
+
</span>
|
|
26
31
|
</Button>
|
|
27
32
|
);
|
|
28
33
|
}
|