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

feat: gnb에서 마이페이지 라우팅 구현 #259

Merged
merged 2 commits into from
Aug 27, 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { MyIcon } from '@/components/atoms/icons/my-icon';
import { NewsIcon } from '@/components/atoms/icons/news-icon';
import { RecordIcon } from '@/components/atoms/icons/record-icon';
import { useCurrentMemberInfo } from '@/hooks';
import { css } from '@/styled-system/css';
import { flex } from '@/styled-system/patterns';

Expand All @@ -11,10 +12,12 @@ import { useGlobalNavigationBar } from './use-global-navigation-bar';

export function GlobalNavigationBar() {
//Todo: 내 userId api로 받아온 후, 마이페이지 route 추가
const { data } = useCurrentMemberInfo();

const barItems = [
{ label: '기록', icon: RecordIcon, route: '/' },
{ label: '소식', icon: NewsIcon, route: '/news' },
{ label: '마이', icon: MyIcon, route: '/profile/2' },
{ label: '마이', icon: MyIcon, route: `/profile/${data?.data.id}` },
];
const { barIndex, handlers } = useGlobalNavigationBar(
barItems.map((item) => item.route),
Expand Down
19 changes: 11 additions & 8 deletions features/profile/components/organisms/my-page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import Link from 'next/link';
import { useState } from 'react';

import { Button } from '@/components/atoms';
Expand All @@ -25,13 +26,15 @@ export function MyProfile({
<section className={profileContainer}>
<ProfileContainer profileData={profileData} />
<div className={buttonContainer}>
<Button
size="small"
label="프로필 편집"
buttonType="assistive"
variant="outlined"
className={buttonStyle}
/>
<Link href="/profile/edit" className={css({ w: 'full' })}>
<Button
size="small"
label="프로필 편집"
buttonType="assistive"
variant="outlined"
className={buttonStyle}
/>
</Link>
<Button
size="small"
label="프로필 공유"
Expand Down Expand Up @@ -94,7 +97,7 @@ const buttonContainer = flex({
});

const buttonStyle = css({
flexGrow: 1,
w: 'full',
});

const tabContainer = flex({
Expand Down
1 change: 1 addition & 0 deletions hooks/apis/use-current-member-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export const useCurrentMemberInfo = () => {
queryKey: ['currentMember'],
queryFn: () => getCurrentMemberInfo(),
placeholderData: keepPreviousData,
staleTime: Infinity,
});
};
Loading