mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-16 00:50:18 -04:00
responsive two-column layout
This commit is contained in:
parent
3241a1591f
commit
99ed5fe2b9
|
@ -1,17 +1,15 @@
|
||||||
import { useEffect } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useState } from 'react';
|
|
||||||
import { getActiveCarpools } from '../api';
|
import { getActiveCarpools } from '../api';
|
||||||
import { ICarpool } from '../types';
|
import { ICarpool } from '../types';
|
||||||
|
import UILink from '../UI/UILink';
|
||||||
import UISecondaryBox from '../UI/UISecondaryBox';
|
import UISecondaryBox from '../UI/UISecondaryBox';
|
||||||
import UISecondaryHeader from '../UI/UISecondaryHeader';
|
|
||||||
|
|
||||||
function ActiveCarpoolListItem({ carpool }: { carpool: ICarpool }) {
|
function ActiveCarpoolListItem({ carpool }: { carpool: ICarpool }) {
|
||||||
return (
|
return (
|
||||||
<UISecondaryBox>
|
<div>
|
||||||
<UISecondaryHeader>
|
<h2>{carpool.name}</h2>
|
||||||
<a href={'/carpools/' + carpool.id}>{carpool.name}</a>
|
<UILink href={`/carpools/${carpool.id}`}>View carpool</UILink>
|
||||||
</UISecondaryHeader>
|
</div>
|
||||||
</UISecondaryBox>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +21,18 @@ export default function ActiveCarpools() {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div
|
||||||
<h1>Carpools</h1>
|
style={{
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<h1 style={{ textAlign: 'center' }}>Carpools</h1>
|
||||||
|
<UISecondaryBox style={{ width: '100%', boxSizing: 'border-box' }}>
|
||||||
{activeCarpools.map((carpool) => (
|
{activeCarpools.map((carpool) => (
|
||||||
<ActiveCarpoolListItem carpool={carpool} key={carpool.id} />
|
<ActiveCarpoolListItem carpool={carpool} key={carpool.id} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</UISecondaryBox>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ export default function ActiveEvents() {
|
||||||
}, [hasEvents, setEvents]);
|
}, [hasEvents, setEvents]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
<h1>Events</h1>
|
<h1 style={{ textAlign: 'center' }}>Events</h1>
|
||||||
<EventStream events={events} />
|
<EventStream events={events} />
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ const style: CSSProperties = {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
width: '30rem',
|
// width: '30rem',
|
||||||
maxWidth: '100%',
|
maxWidth: '100%',
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
|
|
|
@ -53,7 +53,7 @@ export default function Event({
|
||||||
tentativeInvites,
|
tentativeInvites,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<UISecondaryBox>
|
<UISecondaryBox style={{}}>
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
<UISecondaryHeader>{name}</UISecondaryHeader>
|
<UISecondaryHeader>{name}</UISecondaryHeader>
|
||||||
{group && <GroupName group={group} />}
|
{group && <GroupName group={group} />}
|
||||||
|
|
|
@ -3,7 +3,13 @@ import { IEvent } from './types';
|
||||||
|
|
||||||
export default function EventStream({ events }: { events: IEvent[] }) {
|
export default function EventStream({ events }: { events: IEvent[] }) {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
{events.map((event) => (
|
{events.map((event) => (
|
||||||
<Event id={event.id} initial={event} key={event.name} />
|
<Event id={event.id} initial={event} key={event.name} />
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default function GroupJoinerLink() {
|
||||||
const [open, toggle] = useToggle(false);
|
const [open, toggle] = useToggle(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div style={{ width: '100%', textAlign: 'center' }}>
|
||||||
<UIPressable onClick={toggle}>Join Group</UIPressable>
|
<UIPressable onClick={toggle}>Join Group</UIPressable>
|
||||||
{open && (
|
{open && (
|
||||||
<>
|
<>
|
||||||
|
@ -78,6 +78,6 @@ export default function GroupJoinerLink() {
|
||||||
<GroupJoiner />
|
<GroupJoiner />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,8 @@ import UISecondaryBox from '../UI/UISecondaryBox';
|
||||||
|
|
||||||
function GroupListItem({ group }: { group: IGroup }) {
|
function GroupListItem({ group }: { group: IGroup }) {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
<div>
|
||||||
<span
|
<h2>{group.name}</h2>
|
||||||
style={{
|
|
||||||
fontSize: '1.5rem',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
display: 'block',
|
|
||||||
marginTop: '1rem',
|
|
||||||
marginBottom: '1rem',
|
|
||||||
marginRight: '2rem',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{group.name}
|
|
||||||
</span>
|
|
||||||
<UILink href={`/groups/${group.id}`}>View group</UILink>
|
<UILink href={`/groups/${group.id}`}>View group</UILink>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -24,13 +13,7 @@ function GroupListItem({ group }: { group: IGroup }) {
|
||||||
|
|
||||||
export default function GroupList({ groups }: { groups: IGroup[] }) {
|
export default function GroupList({ groups }: { groups: IGroup[] }) {
|
||||||
return (
|
return (
|
||||||
<UISecondaryBox
|
<UISecondaryBox style={{ width: '100%' }}>
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
boxSizing: 'border-box',
|
|
||||||
alignItems: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{groups.map((group) => (
|
{groups.map((group) => (
|
||||||
<GroupListItem group={group} key={group.id} />
|
<GroupListItem group={group} key={group.id} />
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -13,8 +13,13 @@ export default function Groups() {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div
|
||||||
<h1>Groups</h1>
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<h1 style={{ textAlign: 'center' }}>Groups</h1>
|
||||||
<GroupJoinerLink />
|
<GroupJoinerLink />
|
||||||
<br />
|
<br />
|
||||||
<GroupCreatorLink />
|
<GroupCreatorLink />
|
||||||
|
@ -28,6 +33,6 @@ export default function Groups() {
|
||||||
an invite link.
|
an invite link.
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ const baseStyle: CSSProperties = {
|
||||||
borderRadius: '0.5rem',
|
borderRadius: '0.5rem',
|
||||||
padding: '1rem',
|
padding: '1rem',
|
||||||
marginBottom: '1em',
|
marginBottom: '1em',
|
||||||
|
boxSizing: 'border-box',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function UISecondaryBox({
|
export default function UISecondaryBox({
|
||||||
|
|
|
@ -5,9 +5,38 @@ import Groups from './Groups/Groups';
|
||||||
export default function WheelShare() {
|
export default function WheelShare() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Groups />
|
<div
|
||||||
<ActiveCarpools />
|
style={{
|
||||||
<ActiveEvents />
|
display: 'flex',
|
||||||
|
width: '60rem',
|
||||||
|
maxWidth: '100vw',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
flex: 1,
|
||||||
|
padding: '1rem',
|
||||||
|
minWidth: '20rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ActiveCarpools />
|
||||||
|
<Groups />
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
flex: 1,
|
||||||
|
padding: '1rem',
|
||||||
|
minWidth: '20rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ActiveEvents />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user