cloud_bbb/ts/Manager/NewRoomForm.tsx

31 lines
599 B
TypeScript
Raw Normal View History

2020-04-26 11:36:41 +02:00
import React, {useState} from 'react';
type Props = {
2020-04-26 22:41:06 +02:00
addRoom: (name: string) => void;
2020-04-26 11:36:41 +02:00
}
const NewRoomForm: React.FC<Props> = (props) => {
const [name, setName] = useState('');
2020-04-26 11:36:41 +02:00
function addRoom(ev: React.FormEvent) {
ev.preventDefault();
2020-04-26 11:36:41 +02:00
props.addRoom(name);
2020-04-26 11:36:41 +02:00
setName('');
2020-04-26 11:36:41 +02:00
}
return (
<form action="#" onSubmit={addRoom}>
<input
className="newgroup-name"
value={name}
2020-05-16 14:44:21 +02:00
placeholder={t('bbb', 'Room name')}
2020-04-27 16:50:45 +02:00
onChange={(event) => {setName(event.target.value);}} />
2020-05-16 14:44:21 +02:00
<input type="submit" value={t('bbb', 'Create')} />
</form>
2020-04-27 16:50:45 +02:00
);
};
2020-04-26 11:36:41 +02:00
export default NewRoomForm;