Skip to content

Commit

Permalink
styles: prop field (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Dec 13, 2024
1 parent 376c067 commit ea4c5a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-bobcats-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@svecodocs/kit": patch
---

fix: cleanup empty space if no `defaultValue` or `required` in prop field
39 changes: 21 additions & 18 deletions packages/kit/src/lib/components/prop-field.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,27 @@
{@render children?.()}
{/if}
</div>
<div class="mt-3 flex flex-col gap-2">
{#if defaultValue}
<div class="text-muted-foreground flex items-center font-mono">
<span class="text-xs">
default<span class="text-muted-foreground">:</span>
</span>
<span class="text-foreground/90 ml-1 min-w-fit font-mono text-xs">
{defaultValue}

{#if defaultValue || required}
<div class="mt-3 flex flex-col gap-2">
{#if defaultValue}
<div class="text-muted-foreground flex items-center font-mono">
<span class="text-xs">
default<span class="text-muted-foreground">:</span>
</span>
<span class="text-foreground/90 ml-1 min-w-fit font-mono text-xs">
{defaultValue}
</span>
</div>
{/if}
{#if required}
<span
class="relative mr-auto min-w-fit font-mono text-xs text-red-600 dark:text-red-400"
>
required
</span>
</div>
{/if}
{#if required}
<span
class="relative mr-auto min-w-fit font-mono text-xs text-red-600 dark:text-red-400"
>
required
</span>
{/if}
</div>
{/if}
</div>
{/if}
<Separator class="mt-4" />
</div>

0 comments on commit ea4c5a7

Please sign in to comment.