Skip to content

Commit

Permalink
♻️ 타입, 공통 컴포넌트 변경사항 반영 (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyeonzu committed Jan 26, 2025
1 parent 824374a commit 5fa250b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/components/climbing/ReviewBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import AddReactionIcon from '@mui/icons-material/AddReaction';
import useBottomsheet from '@src/hooks/useBottomsheet';
import EmojiList from '@src/components/climbing/EmojiList';
import { useQuery } from '@tanstack/react-query';
import { ClimbingResponse } from '@src/types/apis/climbing.d';
import { getClimbingReview } from '@src/apis/climbing';
import useLoaderData from '@src/hooks/useRoaderData';
import Chip from '@src/components/common/Tag';
Expand Down Expand Up @@ -48,7 +47,7 @@ import { ReactComponent as IcnStar } from '@src/assets/icons/md_star.svg';
const ReviewBoard = () => {
const { openBottomsheet } = useBottomsheet();
const { id: climbingId } = useLoaderData<{ id: number }>();
const { data, isLoading, isError } = useQuery<ClimbingResponse>({
const { data, isLoading, isError } = useQuery({
queryKey: ['climbingReview', climbingId],
queryFn: () => getClimbingReview(climbingId),
});
Expand All @@ -63,8 +62,6 @@ const ReviewBoard = () => {
return <div>No data available</div>;
}

console.log(data);
/* eslint-disable */
return (
<Container>
{data.hasShared && <ClimbingDescription />}
Expand Down
14 changes: 11 additions & 3 deletions src/pages/climbing/ClimbingTerminatePage.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
import ClimbingBoard from '@src/components/climbing/ClimbingBoard';
import Header from '@src/components/common/Header';
import SegmentedButton from '@src/components/climbing/SegmentedButton';
import { useState } from 'react';
import styled from 'styled-components';
import ReviewBoard from '@src/components/climbing/ReviewBoard';
import SegmentedButton from '@src/components/common/SegmentedButton';

export type ViewType = 'climbing' | 'review';

const ClimbingTerminatePage = ({ name: headerText }: { name: string }) => {
const [selectedView, setSelectedView] = useState<ViewType>('climbing');
const [selectedView, setSelectedView] = useState<ViewType>('review');
const handleSegmentChange = (value: ViewType) => {
setSelectedView(value);
};
const SEGMENTED_BUTTON_CONFIG: { value: ViewType; label: string }[] = [
{ value: 'climbing', label: '클라이밍' },
{ value: 'review', label: '감상평' },
];

return (
<>
<Header text={headerText} headerType='back' />
<Container>
<SegmentedButton onSegmentChange={handleSegmentChange} />
<SegmentedButton
config={SEGMENTED_BUTTON_CONFIG}
onSegmentChange={handleSegmentChange}
defaultValue='review'
/>
{selectedView === 'climbing' && <ClimbingBoard />}
{selectedView === 'review' && <ReviewBoard />}
</Container>
Expand Down

0 comments on commit 5fa250b

Please sign in to comment.