📱 Adds wrap mode for phones

This commit is contained in:
Rune Harlyk
2024-08-18 01:41:54 +02:00
committed by Rune Harlyk
parent d8659f8ed5
commit 3fd7f28d7e
5 changed files with 22 additions and 8 deletions
@@ -5,10 +5,11 @@
export let container: WidgetContainerConfig;
</script>
<div class="w-full h-full flex flex-col">
<div class="w-full h-full flex flex-col overflow-hidden">
{#if container.header}
<div class="bg-base-300">
<div class="bg-base-100 p-2 w-min">{container.header}</div>
<div role="tablist" class="tabs tabs-lifted w-min">
<a role="tab" class="tab">{container.header}</a>
<a role="tab" class="tab tab-active">{container.header}</a>
</div>
{/if}
@@ -16,6 +17,7 @@
class="flex w-full h-full"
class:flex-row={container.layout === 'column'}
class:flex-col={container.layout === 'row'}
class:flex-wrap={container.layout === 'wrap'}
>
{#each container.widgets as widget, index (widget.id + '-' + index)}
<Widget size={widget.size ?? 1}>
+13 -1
View File
@@ -13,7 +13,7 @@ export interface WidgetConfig {
export interface WidgetContainerConfig {
id: string | number;
layout: 'row' | 'column';
layout: 'row' | 'column' | 'wrap';
header?: string;
size?: number;
widgets: Array<WidgetConfig | WidgetContainerConfig>;
@@ -29,6 +29,18 @@ export const WidgetComponents = {
CpuUsageChart
};
export const phoneControllerLayout: Writable<WidgetContainerConfig> = persistentStore(
'phone_controller_layout',
{
id: 'root',
layout: 'wrap',
widgets: [
{ id: 2, component: 'Stream' },
{ id: 1, component: 'Visualization', props: { debug: true } }
]
} as WidgetContainerConfig
);
export const controllerLayout: Writable<WidgetContainerConfig> = persistentStore(
'controller_layout',
{
+1 -1
View File
@@ -2,6 +2,6 @@
export let size = 1;
</script>
<div class="box-border overflow-hidden" style="flex: {size}">
<div class="box-border overflow-hidden min-w-96" style="flex: {size}">
<slot></slot>
</div>