-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
456 additions
and
143 deletions.
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
.env | ||
|
||
# vercel | ||
.vercel | ||
|
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
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
33 changes: 33 additions & 0 deletions
33
src/app/(userpage)/userpage/[userId]/components/FollowList/FollowList.module.scss
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,33 @@ | ||
@import "@/styles/_index"; | ||
@import "@/styles/_media"; | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 25px; | ||
width: 100%; | ||
height: 100%; | ||
margin-top: 40px; | ||
overflow: auto; | ||
|
||
@include respond-to(tablet) { | ||
gap: 20px; | ||
} | ||
} | ||
|
||
.listBox { | ||
display: flex; | ||
gap: 20px; | ||
align-items: center; | ||
justify-content: start; | ||
|
||
span { | ||
font-size: 18px; | ||
|
||
@include font-semibold; | ||
|
||
@include respond-to(tablet) { | ||
@include text-normal; | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/app/(userpage)/userpage/[userId]/components/FollowList/FollowList.tsx
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,34 @@ | ||
import Link from "next/link"; | ||
import React from "react"; | ||
import { UserProduct } from "@/app/(userpage)/types"; | ||
import { UserImage } from "@/components/UserImage"; | ||
import cn from "@/utils/classNames"; | ||
import { DEFAULT_PROFILE_IMAGE } from "@/utils/constant"; | ||
import styles from "./FollowList.module.scss"; | ||
|
||
type FollowListProps = { | ||
followData: UserProduct; | ||
}; | ||
|
||
export default function FollowList({ followData }: FollowListProps) { | ||
console.log(followData); | ||
|
||
return ( | ||
<div className={cn(styles.container)}> | ||
{followData.list.map((item) => ( | ||
<Link | ||
href={`/user/${item.id}`} | ||
key={item.id} | ||
className={cn(styles.listBox)} | ||
> | ||
<UserImage | ||
image={item.image === null ? `${DEFAULT_PROFILE_IMAGE}` : item.image} | ||
nickname={item.name} | ||
size='small' | ||
/> | ||
<span>{item.name}</span> | ||
</Link> | ||
))} | ||
</div> | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
src/app/(userpage)/userpage/[userId]/components/FollowModal/FollowModal.module.scss
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,48 @@ | ||
@import "@/styles/_index"; | ||
@import "@/styles/_media"; | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
width: 500px; | ||
height: 660px; | ||
padding: 60px 40px 20px; | ||
|
||
@include respond-to(tablet) { | ||
height: 600px; | ||
} | ||
|
||
@include respond-to(mobile) { | ||
width: 335px; | ||
height: 550px; | ||
padding: 40px 20px 10px; | ||
} | ||
} | ||
|
||
.noFollowBox { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.closeButton { | ||
position: absolute; | ||
top: 20px; | ||
right: 20px; | ||
width: 40px; | ||
height: 40px; | ||
|
||
@include respond-to(tablet) { | ||
width: 36px; | ||
height: 36px; | ||
} | ||
|
||
@include respond-to(mobile) { | ||
top: 15px; | ||
right: 15px; | ||
width: 24px; | ||
height: 24px; | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
src/app/(userpage)/userpage/[userId]/components/FollowModal/FollowModal.tsx
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,72 @@ | ||
import Image from "next/image"; | ||
import { useSession } from "next-auth/react"; | ||
import React, { useEffect, useState } from "react"; | ||
import { UserProduct } from "@/app/(userpage)/types"; | ||
import Modal from "@/components/Modal/Modal"; | ||
import cn from "@/utils/classNames"; | ||
import { CLOSE_ICON } from "@/utils/constant"; | ||
import HttpClient from "@/utils/httpClient"; | ||
import styles from "./FollowModal.module.scss"; | ||
// eslint-disable-next-line no-restricted-imports | ||
import FollowList from "../FollowList/FollowList"; | ||
|
||
type ModalProps = { | ||
followState: string; | ||
isModalState: boolean; | ||
setIsModalState: React.Dispatch<React.SetStateAction<boolean>>; | ||
}; | ||
|
||
export default function FollowModal({ isModalState, setIsModalState, followState }: ModalProps) { | ||
const { data: session } = useSession(); | ||
const [followData, setFollowData] = useState<UserProduct>(); | ||
|
||
const httpClient = new HttpClient(process.env.NEXT_PUBLIC_BASE_URL!); | ||
|
||
const handleData = async () => { | ||
if (session && followState) { | ||
const userId = session.user.id; | ||
const ACCESS_TOKEN = session.accessToken; | ||
setFollowData( | ||
await httpClient.get(`users/${userId}/${followState}`, { | ||
headers: { Authorization: ACCESS_TOKEN }, | ||
cache: "no-cache", | ||
}), | ||
); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
handleData(); | ||
}, [followState]); | ||
|
||
const handleClose = () => setIsModalState(false); | ||
return ( | ||
<> | ||
{followData !== undefined && isModalState && ( | ||
<Modal onClose={handleClose}> | ||
<div className={cn(styles.container)}> | ||
<div | ||
className={cn(styles.closeButton)} | ||
onClick={handleClose} | ||
onKeyDown={handleClose} | ||
role='button' | ||
tabIndex={0} | ||
> | ||
<Image | ||
src={CLOSE_ICON} | ||
alt='닫기버튼' | ||
fill | ||
/> | ||
</div> | ||
<h1>nickname님{followState === "followees" ? "이" : "을"} 팔로우 하는 유저</h1> | ||
{followData.list.length < 1 ? ( | ||
<div className={cn(styles.noFollowBox)}>팔로우하는 유저가 없어요</div> | ||
) : ( | ||
<FollowList followData={followData} /> | ||
)} | ||
</div> | ||
</Modal> | ||
)} | ||
</> | ||
); | ||
} |
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
Oops, something went wrong.