mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 19:29:51 -04:00
add grouip creator
This commit is contained in:
parent
09fa99e89c
commit
776d93acb3
|
@ -1,5 +1,6 @@
|
||||||
import EventCreator from './EventCreator';
|
import EventCreator from './EventCreator';
|
||||||
import Group from './Group';
|
import Group from './Group';
|
||||||
|
import GroupCreator from './GroupCreator';
|
||||||
import UIPrimaryTitle from './UIPrimaryTitle';
|
import UIPrimaryTitle from './UIPrimaryTitle';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
@ -16,6 +17,7 @@ export default function App() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<UIPrimaryTitle>WheelShare</UIPrimaryTitle>
|
<UIPrimaryTitle>WheelShare</UIPrimaryTitle>
|
||||||
|
<GroupCreator />
|
||||||
<EventCreator />
|
<EventCreator />
|
||||||
<Group
|
<Group
|
||||||
events={[
|
events={[
|
||||||
|
|
|
@ -30,6 +30,7 @@ export default function EventCreator() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UISecondaryBox style={{ width: '100%', boxSizing: 'border-box' }}>
|
<UISecondaryBox style={{ width: '100%', boxSizing: 'border-box' }}>
|
||||||
|
<h1 style={{ textAlign: 'center' }}>Create Event</h1>
|
||||||
Name
|
Name
|
||||||
<UITextInput value={name} onChangeText={setName} />
|
<UITextInput value={name} onChangeText={setName} />
|
||||||
<br />
|
<br />
|
||||||
|
|
28
src/components/NewUI/GroupCreator.tsx
Normal file
28
src/components/NewUI/GroupCreator.tsx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import UIButton from './UIButton';
|
||||||
|
import UISecondaryBox from './UISecondaryBox';
|
||||||
|
import UITextInput from './UITextInput';
|
||||||
|
|
||||||
|
export default function GroupCreator() {
|
||||||
|
const [name, setName] = useState('');
|
||||||
|
const createGroup = useCallback(() => {
|
||||||
|
fetch('http://localhost:5000/api/groups', {
|
||||||
|
method: 'post',
|
||||||
|
body: JSON.stringify({
|
||||||
|
name,
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}, [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>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user