Added fwt components
This commit is contained in:
parent
b7409d1c13
commit
b2cbd947c5
30 changed files with 852 additions and 0 deletions
27
fwt/components/Input/Input.tsx
Normal file
27
fwt/components/Input/Input.tsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import './Input.sass'
|
||||
import { createSignal } from 'solid-js'
|
||||
|
||||
interface Props {
|
||||
placeholder?: string
|
||||
value?: string
|
||||
onChange?: (value: string) => void
|
||||
}
|
||||
|
||||
export default (props: Props) => {
|
||||
const [inputValue, setInputValue] = createSignal(props.value || '')
|
||||
|
||||
const handleChange = (event: Event) => {
|
||||
const target = event.target as HTMLInputElement
|
||||
const newValue = target.value
|
||||
setInputValue(newValue)
|
||||
if (props.onChange) {
|
||||
props.onChange(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<input class="input" type="text" placeholder={props.placeholder} value={inputValue()} onInput={handleChange} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue