mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-18 18:10:16 -04:00
24 lines
663 B
TypeScript
24 lines
663 B
TypeScript
import React, { useCallback, useState } from 'react';
|
|
import { post } from './api';
|
|
import UIButton from './UIButton';
|
|
import UISecondaryBox from './UISecondaryBox';
|
|
import UITextInput from './UITextInput';
|
|
|
|
export default function GroupCreator() {
|
|
const [name, setName] = useState('');
|
|
const createGroup = useCallback(() => {
|
|
post('/groups', {
|
|
name,
|
|
});
|
|
}, [name]);
|
|
|
|
return (
|
|
<UISecondaryBox style={{ width: '100%', boxSizing: 'border-box' }}>
|
|
<h1 style={{ textAlign: 'center' }}>Create Group</h1>
|
|
Name
|
|
<UITextInput onChangeText={setName} value={name} />
|
|
<UIButton onClick={createGroup}>Create group</UIButton>
|
|
</UISecondaryBox>
|
|
);
|
|
}
|