-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: basicProfileIcon 추가 * feat: 프로필 컴포넌트 구현 * style: 이미지 크기 수정 * feat: UserList 컴포넌트 구현 * refactor: PR리뷰 반영
- Loading branch information
1 parent
b5c1f0c
commit 7d97f67
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
import { BasicProfileIcon } from '@/assets/icons' | ||
|
||
interface ProfileProps { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Profile } from '..' | ||
|
||
interface User { | ||
id: number | ||
image?: string | ||
name: string | ||
updated_at?: string | ||
responser_count?: number | ||
} | ||
|
||
interface UserListProps { | ||
users: User[] | ||
} | ||
|
||
const UserList = ({ users }: UserListProps) => { | ||
const convertDate = (dates: string) => { | ||
let [date, time] = dates.split('Y') | ||
const timeArr = time.split(':') | ||
|
||
date = date.split('-').join('. ') | ||
time = timeArr[0] + ':' + timeArr[1] | ||
|
||
return date + ', ' + time | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col"> | ||
{users.map((user, index) => ( | ||
<div | ||
key={user.id} | ||
className={`flex flex-row items-center justify-between border border-x-black p-2 ${ | ||
index === users.length - 1 ? 'border-y-black' : 'border-t-black' | ||
}`} | ||
> | ||
<Profile name={user.name} /> | ||
<div className="text-gray-500"> | ||
{user.updated_at | ||
? `답변날짜: ${convertDate(user.updated_at)}` | ||
: `응답자 수: ${user.responser_count}`} | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} | ||
|
||
export default UserList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters