impr: rewrite PostForm component to be stabler and more sustainable (#684)

* impr: rewrite PostForm component into extracted state class

* fix: use base community as PostFormState

* fix: add else clause to ensure 'unset' unsets the language
This commit is contained in:
xylight authored and GitHub committed 2025-11-15 23:12:52 +00:00
1 parent 6f7501ffc5
commit e4507cbf91
16 files changed
+506 -586

No files matched your search

+1
View File
@@ -58,6 +58,7 @@
xl: 'rounded-xl',
lg: 'rounded-lg',
md: 'rounded-md',
inherit: 'rounded-[inherit]',
none: '',
}
type ButtonRoundness = keyof typeof buttonRounding
+10 -8
View File
@@ -35,16 +35,18 @@
.btn-group.btn-group-horizontal {
flex-direction: row;
}
:global(*) {
position: relative;
&:first-child {
border-radius: 24px 8px 8px 24px !important;
}
.btn-group.btn-group-horizontal :global(> *) {
position: relative;
border-radius: 8px 8px 8px 8px !important;
&:last-child {
border-radius: 8px 24px 24px 8px !important;
}
&:first-child {
border-radius: 24px 12px 12px 24px !important;
}
&:last-child {
border-radius: 12px 24px 24px 12px !important;
}
}
</style>
+2 -1
View File
@@ -101,6 +101,7 @@
{disabled}
bind:value
bind:this={element}
{required}
{...rest}
class={[
sizeClass[size],
@@ -118,7 +119,7 @@
{#if suffix}
<div
class={[
'rounded-xl rounded-l-none text-slate-600 dark:text-zinc-400',
'rounded-xl rounded-l-none text-slate-600 dark:text-zinc-400 h-full',
inlineAffixes && 'bg-white dark:bg-zinc-900 pl-0',
]}
>
@@ -12,7 +12,7 @@
bind:open={$shownModal}
>
{#if $shownModal.snippet}
{@render $shownModal.snippet()}
{@render $shownModal.snippet?.()}
{/if}
{#if $shownModal.body}
<p>{$shownModal.body}</p>
+3
View File
@@ -12,6 +12,7 @@
select?: (item: T) => void
input?: import('svelte').Snippet
noresults?: import('svelte').Snippet
required?: boolean
children?: import('svelte').Snippet<
[
{
@@ -47,6 +48,7 @@
query = extractName(item)
onselect?.(item)
},
required,
input,
noresults,
children,
@@ -82,6 +84,7 @@
oninput?.(e)
debounceFunc()
}}
{required}
{...rest}
inlineAffixes
>