mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 11:20:17 -04:00
add grouplist, eventstream
This commit is contained in:
parent
776d93acb3
commit
db955f44b2
|
@ -1,9 +1,19 @@
|
||||||
import EventCreator from './EventCreator';
|
import { useEffect, useState } from 'react';
|
||||||
import Group from './Group';
|
import EventStream from './EventStream';
|
||||||
|
import { IGroup } from './Group';
|
||||||
import GroupCreator from './GroupCreator';
|
import GroupCreator from './GroupCreator';
|
||||||
|
import GroupList from './GroupList';
|
||||||
import UIPrimaryTitle from './UIPrimaryTitle';
|
import UIPrimaryTitle from './UIPrimaryTitle';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
const [groups, setGroups] = useState<IGroup[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetch('http://localhost:5000/api/groups')
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then(setGroups);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
@ -18,8 +28,10 @@ export default function App() {
|
||||||
>
|
>
|
||||||
<UIPrimaryTitle>WheelShare</UIPrimaryTitle>
|
<UIPrimaryTitle>WheelShare</UIPrimaryTitle>
|
||||||
<GroupCreator />
|
<GroupCreator />
|
||||||
<EventCreator />
|
<h1>Groups</h1>
|
||||||
<Group
|
<GroupList groups={groups} />
|
||||||
|
<h1>Events</h1>
|
||||||
|
<EventStream
|
||||||
events={[
|
events={[
|
||||||
{
|
{
|
||||||
time: '11:00 AM to 2:45 PM',
|
time: '11:00 AM to 2:45 PM',
|
||||||
|
@ -34,7 +46,6 @@ export default function App() {
|
||||||
location: 'Dulles, Virginia',
|
location: 'Dulles, Virginia',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name="TJHSST 2022"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
11
src/components/NewUI/EventStream.tsx
Normal file
11
src/components/NewUI/EventStream.tsx
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import Event, { IEvent } from './Event';
|
||||||
|
|
||||||
|
export default function EventStream({ events }: { events: IEvent[] }) {
|
||||||
|
return (
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
|
||||||
|
{events.map((event) => (
|
||||||
|
<Event {...event} key={event.title} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
import Event, { IEvent } from './Event';
|
import { IEvent } from './Event';
|
||||||
|
import EventCreator from './EventCreator';
|
||||||
|
import EventStream from './EventStream';
|
||||||
|
|
||||||
export type IGroup = {
|
export type IGroup = {
|
||||||
|
id: number;
|
||||||
events: IEvent[];
|
events: IEvent[];
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
@ -8,12 +11,9 @@ export type IGroup = {
|
||||||
export default function Group({ events, name }: IGroup) {
|
export default function Group({ events, name }: IGroup) {
|
||||||
return (
|
return (
|
||||||
<div style={{ textAlign: 'center', width: '100%' }}>
|
<div style={{ textAlign: 'center', width: '100%' }}>
|
||||||
|
<EventCreator />
|
||||||
<h1>{name}</h1>
|
<h1>{name}</h1>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
|
<EventStream events={events} />
|
||||||
{events.map((event) => (
|
|
||||||
<Event {...event} key={event.title} />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
|
|
20
src/components/NewUI/GroupList.tsx
Normal file
20
src/components/NewUI/GroupList.tsx
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { IGroup } from './Group';
|
||||||
|
import UISecondaryBox from './UISecondaryBox';
|
||||||
|
|
||||||
|
function GroupListItem({ group }: { group: IGroup }) {
|
||||||
|
return (
|
||||||
|
<UISecondaryBox>
|
||||||
|
<h2 style={{ textAlign: 'center' }}>{group.name}</h2>
|
||||||
|
</UISecondaryBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function GroupList({ groups }: { groups: IGroup[] }) {
|
||||||
|
return (
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
|
||||||
|
{groups.map((group) => (
|
||||||
|
<GroupListItem group={group} key={group.id} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user