2021-12-21 22:42:34 +00:00
|
|
|
import styles from '../styles/Textbox.module.css'
|
|
|
|
|
2022-02-15 17:08:29 +00:00
|
|
|
/**
|
|
|
|
* @param {string} text
|
|
|
|
*/
|
|
|
|
export default function Textbox(PROPERTIES) {
|
2021-12-21 22:42:34 +00:00
|
|
|
return (
|
2022-02-15 17:08:29 +00:00
|
|
|
<input className={styles.Textbox} type={PROPERTIES.type ?? 'text'} style={{width: PROPERTIES.width ?? '200px', ...PROPERTIES.style}} placeholder={PROPERTIES.placeholder ?? 'Type anything here!'} defaultValue={PROPERTIES.value ?? ""} onKeyDown={() => {
|
|
|
|
if (PROPERTIES.submitOnEnter && event.key === 'Enter' && PROPERTIES.submit) {
|
|
|
|
PROPERTIES.submit(event.target.value);
|
2021-12-22 18:59:23 +00:00
|
|
|
event.target.value = "";
|
|
|
|
}
|
2022-02-15 17:08:29 +00:00
|
|
|
}}
|
|
|
|
/>
|
2021-12-21 22:42:34 +00:00
|
|
|
)
|
|
|
|
}
|