member list carpools

This commit is contained in:
Joshua Hsueh 2021-07-12 22:47:17 -04:00
commit 8dcc40fa43
2 changed files with 74 additions and 33 deletions

View File

@ -1,11 +1,17 @@
import EventIcon from '@material-ui/icons/Event'; import EventIcon from '@material-ui/icons/Event';
import LocationOnIcon from '@material-ui/icons/LocationOn'; import LocationOnIcon from '@material-ui/icons/LocationOn';
import MailOutlineIcon from '@material-ui/icons/MailOutline';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import { useState } from 'react'; import { useState } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { ICarpool } from '../types'; import { ICarpool } from '../types';
import UISecondaryBox from '../UI/UISecondaryBox'; import UISecondaryBox from '../UI/UISecondaryBox';
import MemberList from './MemberList'; import MemberList from './MemberList';
import UIButton from '../UI/UIButton';
import { lightgrey } from '../colors';
export default function Carpool() { export default function Carpool() {
const id = +useParams<{ id: string }>().id; const id = +useParams<{ id: string }>().id;
@ -52,9 +58,39 @@ export default function Carpool() {
<UISecondaryBox style={{ width: '100%', alignItems: 'center' }}> <UISecondaryBox style={{ width: '100%', alignItems: 'center' }}>
{carpool ? ( {carpool ? (
<> <>
<h1>{name}</h1> <h1 style={{ marginBottom: '0rem' }}>{name}</h1>
<h2>{event.name}</h2> <h2 style={{ marginBottom: '0rem' }}>{event.name}</h2>
<div style={{ fontSize: '1.5rem', fontWeight: 600 }}> <div
style={{
display: 'flex',
flexDirection: 'row',
margin: '0.5rem 0',
}}
>
<UIButton
style={{
marginRight: '0.25rem',
backgroundColor: lightgrey,
display: 'flex',
alignItems: 'center',
}}
onClick={console.log}
>
<MailOutlineIcon style={{ marginRight: '0.5rem' }} /> 1 request
</UIButton>
<UIButton
style={{
marginLeft: '0.25rem',
backgroundColor: lightgrey,
display: 'flex',
alignItems: 'center',
}}
onClick={console.log}
>
<PersonAddIcon style={{ marginRight: '0.5rem' }} /> Invite
</UIButton>
</div>
<div style={{ fontSize: '1.5rem', fontWeight: 400 }}>
<div <div
style={{ style={{
color: '#303030', color: '#303030',
@ -76,7 +112,6 @@ export default function Carpool() {
DAWN - DUSK DAWN - DUSK
</div> </div>
</div> </div>
<h3>Members</h3>
<MemberList members={carpool.members} /> <MemberList members={carpool.members} />
</> </>
) : ( ) : (

View File

@ -9,35 +9,41 @@ export default function MemberList({
}[]; }[];
}) { }) {
return ( return (
<div className="MemberList"> <div
<div style={{ display: 'flex', flexDirection: 'column' }}> className="MemberList"
<h3 style={{ marginBlockEnd: '0' }}>Members</h3> style={{
{members.length > 0 ? ( display: 'flex',
<div> flexDirection: 'column',
{members.map((member, index) => { alignSelf: 'center',
return index < 2 ? ( alignItems: 'flex-start',
<div }}
className="member" >
style={{ display: 'flex', justifyContent: 'space-around' }} <h3 style={{ marginBlockEnd: '0' }}>Members</h3>
> {members.length > 0 ? (
{} <div>
<AccountCircleIcon /> {members.map((member, index) => {
<div key={member.id}>{member.name}</div> return index < 2 ? (
</div> <div
) : ( className="member"
'' style={{ display: 'flex', alignItems: 'center' }}
); >
})} {}
{members.length > 2 <AccountCircleIcon style={{ marginRight: '8px' }} />
? members.length - 2 == 1 <div key={member.id}>{member.name}</div>
? members.length - 2 + ' other...' </div>
: members.length - 2 + ' others...' ) : (
: ''}{' '} ''
</div> );
) : ( })}
'This carpool has no members.' {members.length > 2
)} ? members.length - 2 == 1
</div> ? members.length - 2 + ' other...'
: members.length - 2 + ' others...'
: ''}{' '}
</div>
) : (
'This carpool has no members.'
)}
</div> </div>
); );
} }