Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: mypage & notification 드롭 다운 컴포넌트 수정 #44

Merged
merged 5 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions components/NavigationDropdown/NotificationDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function NotificationDropdown({

return (
<div className="z-50 px-[20px] pt-[17px] pb-[24px] absolute top-[60px] right-[400px] t:right-[100px] w-[368px] h-[340px] animate-slideDown flex-col justify-center overflow-y-auto scrollbar-hide rounded-[5px] m:fixed m:inset-0 m:rounded-none m:w-full m:h-full bg-var-green1 m:overflow-y-hidden ">
<div className="flex text-[20px] font-bold mb-[25px] justify-between ">
<div className="flex text-[20px] font-bold mb-[15px] justify-between ">
알림 {data ? `${data.totalCount}` : '0'}개
<CloseButton onClick={onClick} />
</div>
Expand All @@ -69,9 +69,9 @@ export default function NotificationDropdown({
{notificationList.map((notification) => (
<div
key={notification.id}
className="flex-col items-center px-[12px] py-[16px] justify-between rounded-[5px] border-b w-[328px] h-[120px] m:w-[335px] m:h-[105px] bg-white border-gray-200 "
className="flex flex-col text-[14px] px-[10px] justify-between pt-[15px] pb-[5px] rounded-[5px] border-b w-[328px] h-[125px] m:w-[335px] bg-white border-gray-200 "
>
<div className="flex justify-between m:mb-[5px]">
<div className="flex justify-between">
<StatusIndicator
size="small"
status={
Expand All @@ -80,14 +80,16 @@ export default function NotificationDropdown({
: 'denied'
}
/>
<div className="m:hidden h-[24px]">
<div className="h-[24px]">
<CloseButton onClick={() => handleDelete(notification.id)} />
</div>
</div>
<div className="w-[298px] h-[44px] mb-[4px]">
<p>{ContentWithHighlights(notification.content)}</p>
<div className="w-[298px] h-[44px] mt-[-20px] ">
{ContentWithHighlights(notification.content)}
</div>
<div className="text-[12px]">
{formatTimeAgo(notification.updatedAt)}
</div>
<p>{formatTimeAgo(notification.updatedAt)}</p>
</div>
))}
{hasNextPage && <div ref={ref} />}
Expand Down
16 changes: 15 additions & 1 deletion pages/mypage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import MyPageInput from '@/components/MyPageInput/MyPageInput';
import SidenNavigation from '@/components/SideNavigation/SideNavigation';
import SidenNavigationMobile from '@/components/SideNavigation/SideNavigationMobile';
import useLoginState from '@/hooks/useLoginState';
import { useSideNavigation } from '@/hooks/useSideNavigation';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import { useEffect } from 'react';

export default function MyPage() {
const route = useRouter();
const { isLoggedIn } = useLoginState();
const { isOpen } = useSideNavigation();

useEffect(() => {
if (!isLoggedIn) {
route.push('/login');
}
}, [isLoggedIn, route]);

if (!isLoggedIn) {
return null;
}

return (
<>
<div
Expand Down