File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { useNavigate } from 'react-router-dom'
2
2
import * as S from './styles'
3
+ import { useModalStore } from '~stores/modalStore'
3
4
4
5
type ProfileProps = {
5
6
$size : number
@@ -8,7 +9,12 @@ type ProfileProps = {
8
9
}
9
10
10
11
export default function Profile ( { $size, $src, userId } : ProfileProps ) {
12
+ const { clearModal } = useModalStore ( )
11
13
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 } />
14
20
}
Original file line number Diff line number Diff line change @@ -3,10 +3,13 @@ import styled from 'styled-components'
3
3
type ProfileProps = {
4
4
$size : number
5
5
$src : string
6
+ $userId ?: string
6
7
}
8
+
7
9
export const Profile = styled . div < ProfileProps > `
8
10
width: ${ ( { $size } ) => $size + 'px' } ;
9
11
height: ${ ( { $size } ) => $size + 'px' } ;
10
12
background: url(${ ( { $src } ) => $src } ) center/cover ${ ( { theme } ) => theme . colors . brand . sub } ;
13
+ cursor: ${ ( { $userId } ) => ( $userId ? 'pointer' : 'default' ) } ;
11
14
border-radius: 50%;
12
15
`
You can’t perform that action at this time.
0 commit comments