@@ -3,11 +3,21 @@ import {
33 InstagramIcon ,
44 LinkedInIcon ,
55 MediumIcon ,
6+ RobotIcon ,
67 SunIcon ,
78} from '@assets' ;
8- import { IconButton , transition , VStack } from '@chakra-ui/react' ;
9+ import {
10+ Box ,
11+ IconButton ,
12+ Menu ,
13+ MenuButton ,
14+ MenuItem ,
15+ MenuList ,
16+ Text ,
17+ VStack ,
18+ } from '@chakra-ui/react' ;
919import { useCursor } from '@components' ;
10- import { useRef } from 'react' ;
20+ import { RefObject , useRef } from 'react' ;
1121
1222const IconProps = {
1323 variant : 'ghost' ,
@@ -19,43 +29,82 @@ const IconProps = {
1929 } ,
2030} ;
2131
22- const SocialNavigation = ( ) => {
32+ const SocialNavigation = ( {
33+ handleCharacterClick : handlerCharacterClick ,
34+ } : {
35+ handleCharacterClick : ( type : 'adam' | 'lieutenant' ) => void ;
36+ } ) => {
2337 const ref = useRef < HTMLDivElement > ( null ) ;
38+ const menuButtonRef = useRef < HTMLDivElement > ( null ) ;
2439 const { setCursorInsets } = useCursor ( ) ;
25- const onMouseEnter = ( ) => {
26- const { width, height, top, left } =
27- ref . current ?. getBoundingClientRect ( ) || {
28- width : 56 ,
29- height : 56 ,
30- top : 0 ,
31- left : 0 ,
32- } ;
33- setCursorInsets ( undefined ) ;
34- setTimeout ( ( ) => {
35- setCursorInsets ( { height, width, top, left, borderRadius : '30px' } ) ;
36- } , 0 ) ;
37- } ;
40+ const onMouseEnter =
41+ ( ref : RefObject < HTMLDivElement > , radius : string ) => ( ) => {
42+ const { width, height, top, left } =
43+ ref . current ?. getBoundingClientRect ( ) || {
44+ width : 56 ,
45+ height : 56 ,
46+ top : 0 ,
47+ left : 0 ,
48+ } ;
49+ setCursorInsets ( undefined ) ;
50+ setTimeout ( ( ) => {
51+ setCursorInsets ( { height, width, top, left, borderRadius : radius } ) ;
52+ } , 0 ) ;
53+ } ;
3854 const onMouseLeave = ( ) => {
3955 setCursorInsets ( undefined ) ;
4056 } ;
4157 return (
42- < VStack
43- ref = { ref }
44- position = { 'fixed' }
45- bottom = { 20 }
46- right = { 10 }
47- px = { 2 }
48- py = { 5 }
49- border = { '1px solid white' }
50- borderRadius = { '30px' }
51- outline = { '1px solid violet' }
52- onMouseEnter = { onMouseEnter }
53- onMouseLeave = { onMouseLeave }
54- >
55- < IconButton aria-label = "" icon = { < GithubIcon /> } { ...IconProps } />
56- < IconButton icon = { < LinkedInIcon /> } aria-label = "" { ...IconProps } />
57- < IconButton icon = { < MediumIcon /> } aria-label = "" { ...IconProps } />
58- < IconButton icon = { < InstagramIcon /> } aria-label = "" { ...IconProps } />
58+ < VStack position = { 'fixed' } bottom = { 20 } right = { 10 } rowGap = { 10 } >
59+ < Box
60+ ref = { menuButtonRef }
61+ onMouseEnter = { onMouseEnter ( menuButtonRef , '6px' ) }
62+ onMouseLeave = { onMouseLeave }
63+ >
64+ < Menu isLazy placement = "top-start" closeOnBlur closeOnSelect = { true } >
65+ < MenuButton >
66+ < IconButton
67+ variant = { 'outline' }
68+ aria-label = "Options"
69+ icon = { < RobotIcon height = { '2em' } width = { '2em' } /> }
70+ />
71+ </ MenuButton >
72+ < MenuList
73+ style = { {
74+ backgroundColor : 'transparent' ,
75+ color : 'violet' ,
76+ padding : '0px' ,
77+ boxShadow : '0px 0px 20px 8px violet' ,
78+ } }
79+ >
80+ < MenuItem onClick = { ( ) => handlerCharacterClick ( 'adam' ) } >
81+ < Text key = { 'adam' } fontSize = { 'xl' } >
82+ Adam
83+ </ Text >
84+ </ MenuItem >
85+ < MenuItem onClick = { ( ) => handlerCharacterClick ( 'lieutenant' ) } >
86+ < Text key = { 'Lieutenant' } fontSize = { 'xl' } >
87+ Lieutenant
88+ </ Text >
89+ </ MenuItem >
90+ </ MenuList >
91+ </ Menu >
92+ </ Box >
93+ < VStack
94+ ref = { ref }
95+ px = { 2 }
96+ py = { 5 }
97+ border = { '1px solid white' }
98+ borderRadius = { '30px' }
99+ outline = { '1px solid violet' }
100+ onMouseEnter = { onMouseEnter ( ref , '30px' ) }
101+ onMouseLeave = { onMouseLeave }
102+ >
103+ < IconButton aria-label = "" icon = { < GithubIcon /> } { ...IconProps } />
104+ < IconButton icon = { < LinkedInIcon /> } aria-label = "" { ...IconProps } />
105+ < IconButton icon = { < MediumIcon /> } aria-label = "" { ...IconProps } />
106+ < IconButton icon = { < InstagramIcon /> } aria-label = "" { ...IconProps } />
107+ </ VStack >
59108 </ VStack >
60109 ) ;
61110} ;
0 commit comments