Skip to content

Commit

Permalink
Add bracket item list style and rework padding
Browse files Browse the repository at this point in the history
  • Loading branch information
dokempf committed Jul 26, 2024
1 parent 00f7698 commit 55d9006
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/components/fields/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

{#if hasField(data, table, field)}
{#if !condensed}
<P class="pt-4">
<P>
<FieldLabel table={table} field={field} />
</P>
{/if}
Expand Down
9 changes: 8 additions & 1 deletion src/components/fields/LinkedTable.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<script>
import { List } from "flowbite-svelte";
export let bracket;
import "./bracket.css";
</script>

<slot/>
<List class={bracket ? "bracket-list" : null}>
<slot/>
</List>
24 changes: 24 additions & 0 deletions src/components/fields/bracket.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.bracket-list {
list-style: none;
padding: 7px 0 7px 10px;
margin-right: -15px;
position: relative;
border-left: 2px solid #dbdbe1;
}

.bracket-list::before, .bracket-list::after {
content: "";
position: absolute;
background: #dbdbe1;
width: 10px;
height: 2px;
left: 0;
}

.bracket-list::before {
top: 0;
}

.bracket-list::after {
bottom: 0;
}
4 changes: 2 additions & 2 deletions src/components/logic/FieldDispatch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@

<!-- Fields that are not present in the data are also omitted -->
{#if hasField(data, table, field) }
<svelte:component this={WrapperComponent} class="pt-4">
<svelte:component this={WrapperComponent}>
{#if !condensed}
<P class="pt-4">
<P>
<FieldLabel table={table} field={field}/>
</P>
{/if}
Expand Down
20 changes: 9 additions & 11 deletions src/components/logic/RecursiveEasyDBDetailView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { fieldData, hasReverseSubData, hasSubData, linkedSubData, maskObj, reverseLinkedSubData, splitterTitle } from "../../lib/easydbHelpers";
import { easydb_api_object } from "../../lib/apiaccess";
import { Card, Li, List, P } from "flowbite-svelte";
import { Card, Li, P } from "flowbite-svelte";
import CustomSplitterDispatch from "./CustomSplitterDispatch.svelte";
import FieldDispatch from "./FieldDispatch.svelte";
Expand Down Expand Up @@ -109,26 +109,24 @@
{:else if firstField.kind === "linked-table" }
{#if firstField.output[output] && hasSubData(data, table, firstField)}
{#if !condensed }
<P class="pt-4">
<P>
<FieldLabel field={firstField} table={firstField.other_table_name_hint}/>
</P>
{/if}
<LinkedTable>
<List>
{#each linkedSubData(data, table, firstField) as subdata}
<Li>
<svelte:self fields={firstField.mask.fields} data={subdata} table={firstField.other_table_name_hint} condensed={decideCondense(firstField)} output={output}/>
</Li>
{/each}
</List>
<LinkedTable bracket={!decideCondense(firstField)}>
{#each linkedSubData(data, table, firstField) as subdata}
<Li>
<svelte:self fields={firstField.mask.fields} data={subdata} table={firstField.other_table_name_hint} condensed={decideCondense(firstField)} output={output}/>
</Li>
{/each}
</LinkedTable>
{/if}
<svelte:self fields={fields.slice(1)} data={data} table={table} condensed={condensed} output={output}/>
{:else if firstField.kind === "reverse-linked-table" }
{#if firstField.output[output] && hasReverseSubData(data, table, firstField) }
<ReverseLinkedTable>
{#each reverseLinkedSubData(data, table, firstField) as subdata }
<Card class="max-w-full">
<Card class="max-w-full space-y-4">
<svelte:self fields={firstField.mask.fields} data={subdata} table={firstField.other_table_name_hint} condensed={condensed} output={output}/>
</Card>
{/each}
Expand Down
4 changes: 2 additions & 2 deletions src/components/splitter/Panel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
</script>

{#if hasContent(data, table, fields, output)}
<Accordion class="pt-6">
<Accordion>
<AccordionItem open={options.default_open_detail}>
<span slot="header">{splitterTitle(data, table, options, $appLanguageStore)}</span>
<div class="-mt-4">
<div class="space-y-4">
<slot />
</div>
</AccordionItem>
Expand Down
2 changes: 1 addition & 1 deletion src/components/splitter/Split.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
export let table;
</script>

<Heading tag="h6" class="pt-4">
<Heading tag="h6">
{splitterTitle(data, table, JSON.parse(field.options), $appLanguageStore)}
</Heading>
4 changes: 3 additions & 1 deletion src/components/splitter/TabItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

{#if hasContent(data, table, fields, output) }
<TabItem open={open} title={splitterTitle(data, table, options, $appLanguageStore)}>
<slot />
<div class="space-y-4">
<slot />
</div>
</TabItem>
{/if}

0 comments on commit 55d9006

Please sign in to comment.