1
Fork 0
mirror of https://github.com/Steffo99/bluelib.git synced 2024-12-25 13:04:20 +00:00
bluelib/src/components/inputs/Select.tsx

44 lines
991 B
TypeScript
Raw Normal View History

2021-08-19 17:54:58 +00:00
import * as React from "react"
import * as ReactDOM from "react-dom"
import * as Types from "../../types"
import {BaseElement} from "../BaseElement"
import mergeClassNames from "classnames"
interface SelectProps {
disabled?: boolean,
onChange?: (contents: string) => boolean,
value?: string,
children: React.ReactNode,
[props: string]: any,
}
export function Select({onChange, children, ...props}: SelectProps): JSX.Element {
props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "input", "input-select")
const onChangeWrapper = React.useCallback(
(event: React.ChangeEvent<HTMLInputElement>): boolean => {
const contents = event.target.value
if(onChange) {
return onChange(contents)
}
return false
},
[onChange]
)
return (
<BaseElement kind={"select"} multiple={false} {...props}>
// TODO
</BaseElement>
)
}