Skip to content

Commit

Permalink
style: 자신의 게시글의 경우 투표 옵션 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonjinan096 committed Jul 2, 2024
1 parent 4996798 commit 6cc9f3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/app/(post)/result/[postId]/_components/Posting/VoteForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ const VoteForm = () => {
onChange={() => handleOptionChange(seq)}
className='hidden'
/>
{selectedOption === seq ? (
<Icon id='select-vote' size={24} />
) : (
<Icon id='select-default' size={24} />
)}
{!isAuthor &&
(selectedOption === seq ? (
<Icon id='select-vote' size={24} />
) : (
<Icon id='select-default' size={24} />
))}
<span className='font-text-1-rg'>{voteOptionContent}</span>
{voteOptionImageUrl && (
<Image
Expand Down
15 changes: 10 additions & 5 deletions src/app/(post)/result/[postId]/_components/Posting/VoteResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import Image from 'next/image';
import { useParams } from 'next/navigation';

import { useGetPostDetailAPI } from '@/src/apis/postDetail';
import { useGetVoteDetailAPI } from '@/src/apis/vote';
import Icon from '@/src/components/Icon';
import { cn } from '@/src/utils/cn';
Expand All @@ -19,6 +20,8 @@ const VoteResult = () => {

const maxCount = Math.max(...voteOptions.map(({ count }) => count));

const { isAuthor } = useGetPostDetailAPI(postId);

return (
<div className='flex items-center justify-center rounded-[8px] bg-gray-accent1'>
<div className='flex w-full flex-col gap-6 p-4'>
Expand All @@ -43,11 +46,13 @@ const VoteResult = () => {
key={voteOptionId}
className='relative flex cursor-default items-center gap-4 rounded-[8px] border border-gray-accent3 px-3 py-2'
>
{choiceVoteOptionId === voteOptionId ? (
<Icon id='select-vote' size={24} />
) : (
<Icon id='select-default' size={24} />
)}
{!isAuthor &&
(choiceVoteOptionId === voteOptionId ? (
<Icon id='select-vote' size={24} />
) : (
<Icon id='select-default' size={24} />
))}

<div className='flex flex-grow flex-col'>
<span className='font-text-1-rg'>{voteOptionContent}</span>
<div className='flex w-full items-center gap-3'>
Expand Down

0 comments on commit 6cc9f3c

Please sign in to comment.