Added versitality

This commit is contained in:
Patrick Alvin Alcala 2025-06-05 17:41:03 +08:00
parent 2b1545f999
commit 61be8e2cab
2 changed files with 7 additions and 5 deletions

View file

@ -27,7 +27,7 @@ $border: 1px solid color.adjust(vars.$background, $lightness: 20%)
padding: 0.5rem
color: color.adjust(vars.$background, $lightness: 60%)
outline: none
transition: all 0.4s ease-out
transition: all 0.2s ease-out
&:hover
border-color: color.adjust(vars.$background, $lightness: 30%)

View file

@ -2,12 +2,14 @@ import './Input.sass'
import { Show } from 'solid-js'
import { TextField } from '@kobalte/core/text-field'
export default (props: { value: string; onChange: (text:string) => void; label: string; isTextField?: boolean }) => (
export default (props: { value: string; onChange: (text: string) => void; label?: string; isTextField?: boolean; width?: number; height?: number }) => (
<>
<TextField class="input" value={props.value} onChange={props.onChange} >
<Show when={props.label}>
<TextField.Label class="input__label">{props.label}:</TextField.Label>
</Show>
<Show when={props.isTextField}>
<TextField.TextArea class="input__textarea" />
<TextField.TextArea class="input__textarea" style={{ width: props.width ? `${props.width}rem` : '100%', height: props.height ? `${props.height}rem` : 'auto' }} />
</Show>
<Show when={!props.isTextField}>
<TextField.Input class="input__text" />