Merge pull request #17 from nightbug-xx/hp4atl-codex/친구정보-출력-문제-수정
Improve friend list layout
This commit is contained in:
commit
056e2b5589
@ -1,3 +1,12 @@
|
||||
import {
|
||||
Box,
|
||||
Card,
|
||||
CardContent,
|
||||
Container,
|
||||
Grid,
|
||||
Typography,
|
||||
Button,
|
||||
} from '@mui/material'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import api from '../lib/api'
|
||||
@ -26,26 +35,51 @@ export default function FriendListPage() {
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>친구 목록</h2>
|
||||
<button onClick={() => setShowDialog(true)}>+ 친구 추가</button>
|
||||
|
||||
{friends.length === 0 ? (
|
||||
<p>친구가 없습니다.</p>
|
||||
) : (
|
||||
<ul>
|
||||
<Container sx={{ mt: 4 }}>
|
||||
<Typography variant="h5" gutterBottom>
|
||||
친구 목록
|
||||
</Typography>
|
||||
<Grid container spacing={2}>
|
||||
{friends.map(friend => (
|
||||
<li key={friend.id}>
|
||||
{friend.email}
|
||||
<button onClick={() => navigate(`/friends/${friend.id}/characters`)}>
|
||||
<Grid item xs={12} sm={6} md={4} key={friend.id} {...({} as any)}>
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Typography variant="h6">{friend.email}</Typography>
|
||||
<Box sx={{ mt: 1 }}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={() =>
|
||||
navigate(`/friends/${friend.id}/characters`)
|
||||
}
|
||||
>
|
||||
캐릭터 보기
|
||||
</button>
|
||||
</li>
|
||||
</Button>
|
||||
</Box>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Grid>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
<Grid item xs={12} sm={6} md={4} {...({} as any)}>
|
||||
<Card
|
||||
onClick={() => setShowDialog(true)}
|
||||
sx={{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
<CardContent>
|
||||
<Typography variant="h6" align="center">
|
||||
+ 친구 추가
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{showDialog && <FriendSearchDialog onClose={() => setShowDialog(false)} />}
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user