Skip to content

Commit 4249ed2

Browse files
committed
chore: cleaned the unnecessary classes and variables for input type radio.
1 parent dcdd7d4 commit 4249ed2

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

platforms/metagram/src/lib/ui/Input/Input.svelte

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,10 @@
2323
2424
let radioElement: HTMLInputElement | null = $state(null);
2525
26-
const typeClasses: Record<string, string> = {
27-
radio: 'opacity-100'
28-
};
26+
const cbase =
27+
'w-full bg-grey py-3.5 px-6 text-[15px] text-black-800 font-geist font-normal placeholder:text-black-600 rounded-4xl outline-0 border border-transparent invalid:border-red invalid:text-red focus:invalid:text-black-800 focus:invalid:border-transparent';
2928
30-
const cbase = $derived({
31-
common: 'w-full bg-grey py-3.5 px-6 text-[15px] text-black-800 font-geist font-normal placeholder:text-black-600 rounded-4xl outline-0 border border-transparent invalid:border-red invalid:text-red focus:invalid:text-black-800 focus:invalid:border-transparent',
32-
type: typeClasses[type]
33-
});
34-
35-
const radioCustomStyles = $derived({
29+
const customRadioStyles = $derived({
3630
common: "before:h-4.5 before:w-4.5 before:border-brand-burnt-orange before:-left-0.75 before:-bottom-0.25 relative before:absolute before:rounded-full before:border-2 before:bg-white before:content-['']",
3731
selected:
3832
'after:h-2.5 after:w-2.5 after:bg-brand-burnt-orange after:absolute after:bottom-0.75 after:left-0.25 after:rounded-full'
@@ -42,7 +36,7 @@
4236
{#if type === 'radio'}
4337
<div
4438
class={cn(
45-
[radioCustomStyles.common, selected === value ? radioCustomStyles.selected : ''].join(
39+
[customRadioStyles.common, selected === value ? customRadioStyles.selected : ''].join(
4640
' '
4741
)
4842
)}
@@ -60,7 +54,7 @@
6054
bind:this={radioElement}
6155
{name}
6256
checked={selected === value}
63-
class={cn([cbase.common, cbase.type, restProps.class].join(' '))}
57+
class={cn([cbase, restProps.class].join(' '))}
6458
tabindex="0"
6559
/>
6660
</div>
@@ -71,7 +65,7 @@
7165
{placeholder}
7266
bind:this={input}
7367
bind:value
74-
class={cn([cbase.common, cbase.type, restProps.class].join(' '))}
68+
class={cn([cbase, restProps.class].join(' '))}
7569
tabindex="0"
7670
/>
7771
{/if}

0 commit comments

Comments
 (0)