diff --git a/src/lib/components/ui/DetailItem.svelte b/src/lib/components/ui/DetailItem.svelte index 3aabd9f1..a6a6699b 100644 --- a/src/lib/components/ui/DetailItem.svelte +++ b/src/lib/components/ui/DetailItem.svelte @@ -2,21 +2,68 @@ -
+
{label} - {#if children} + {#if editable} +
+ {#if type === 'select' && options} + + {checkboxValue ? 'Yes' : 'No'} + + {:else if type === 'number'} + + {:else} + + {/if} +
+ {:else if children}
{@render children()}
@@ -30,6 +77,7 @@ @use '$src/themes/layout' as layout; @use '$src/themes/spacing' as spacing; @use '$src/themes/typography' as typography; + @use '$src/themes/effects' as effects; .detail-item { display: flex; @@ -39,14 +87,26 @@ background: colors.$grey-90; border-radius: layout.$item-corner; font-size: typography.$font-regular; + min-height: calc(spacing.$unit * 5); - &:hover { + &:hover:not(.editable) { background: colors.$grey-80; } + &.editable:hover, + &.editable:focus-within { + background: var(--input-bg-hover); + } + + &.editable { + background: var(--input-bg); + } + .label { font-weight: typography.$medium; color: colors.$grey-50; + flex-shrink: 0; + margin-right: spacing.$unit-2x; } .value { @@ -54,5 +114,39 @@ display: flex; align-items: center; } + + .edit-value { + flex: 1; + display: flex; + flex-grow: 0; + justify-content: flex-end; + + :global(.input), + :global(.select) { + min-width: 180px; + } + + :global(.input.number) { + min-width: 120px; + } + } + + .checkbox-wrapper { + display: flex; + align-items: center; + gap: spacing.$unit; + cursor: pointer; + + .checkbox { + width: spacing.$unit-2x; + height: spacing.$unit-2x; + cursor: pointer; + } + + .checkbox-label { + color: var(--text-primary); + user-select: none; + } + } } diff --git a/src/lib/components/ui/DetailsHeader.svelte b/src/lib/components/ui/DetailsHeader.svelte index 4b25a529..c5470f23 100644 --- a/src/lib/components/ui/DetailsHeader.svelte +++ b/src/lib/components/ui/DetailsHeader.svelte @@ -1,22 +1,35 @@
-
-

{getDisplayName(name)}

-
- {#if element !== undefined} - - {/if} - {#if (type === 'character' || type === 'weapon') && proficiency} - {#if Array.isArray(proficiency)} - {#if proficiency[0] !== undefined} - - {/if} - {#if proficiency[1] !== undefined} - - {/if} - {:else if proficiency !== undefined} - +
+
+ {getDisplayName(name)} { + const placeholder = + type === 'character' + ? '/images/placeholders/placeholder-character-main.png' + : type === 'summon' + ? '/images/placeholders/placeholder-summon-main.png' + : '/images/placeholders/placeholder-weapon-main.png' + ;(e.currentTarget as HTMLImageElement).src = placeholder + }} + /> +
+ +
+

{getDisplayName(name)}

+
+ {#if element !== undefined} + {/if} - {/if} + {#if (type === 'character' || type === 'weapon') && proficiency} + {#if Array.isArray(proficiency)} + {#if proficiency[0] !== undefined} + + {/if} + {#if proficiency[1] !== undefined} + + {/if} + {:else if proficiency !== undefined} + + {/if} + {/if} +
-
- {getDisplayName(name)} { - const placeholder = - type === 'character' - ? '/images/placeholders/placeholder-character-main.png' - : type === 'summon' - ? '/images/placeholders/placeholder-summon-main.png' - : '/images/placeholders/placeholder-weapon-main.png' - ;(e.currentTarget as HTMLImageElement).src = placeholder - }} - /> -
+ {#if showEdit} +
+ {#if editMode} + + + {:else} + + {/if} +
+ {/if}