Skip to content

Commit 758f566

Browse files
committed
🐛Fix: Profile 클릭 시 clearModal
1 parent 0c056b9 commit 758f566

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/components/Profile/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useNavigate } from 'react-router-dom'
22
import * as S from './styles'
3+
import { useModalStore } from '~stores/modalStore'
34

45
type ProfileProps = {
56
$size: number
@@ -8,7 +9,12 @@ type ProfileProps = {
89
}
910

1011
export default function Profile({ $size, $src, userId }: ProfileProps) {
12+
const { clearModal } = useModalStore()
1113
const navigate = useNavigate()
12-
const onClick = () => userId && navigate(`/profile/${userId}`)
13-
return <S.Profile $size={$size} $src={$src} onClick={onClick} />
14+
const onClick = () => {
15+
if (!userId) return
16+
navigate(`/profile/${userId}`)
17+
clearModal()
18+
}
19+
return <S.Profile $size={$size} $src={$src} $userId={userId} onClick={onClick} />
1420
}

src/components/Profile/styles.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import styled from 'styled-components'
33
type ProfileProps = {
44
$size: number
55
$src: string
6+
$userId?: string
67
}
8+
79
export const Profile = styled.div<ProfileProps>`
810
width: ${({ $size }) => $size + 'px'};
911
height: ${({ $size }) => $size + 'px'};
1012
background: url(${({ $src }) => $src}) center/cover ${({ theme }) => theme.colors.brand.sub};
13+
cursor: ${({ $userId }) => ($userId ? 'pointer' : 'default')};
1114
border-radius: 50%;
1215
`

0 commit comments

Comments
 (0)