11import Lottie from 'lottie-react'
22import styled from 'styled-components'
33
4- import { Cancel , CoachMarkArrow } from '@/assets/icons'
54import { SwipeLottie } from '@/assets/lottie'
6- import { useDevice } from '@/shared/lib/useDevice'
7- import { Cd , SvgButton } from '@/shared/ui'
5+ import { flexColCenter } from '@/shared/styles/mixins'
86
97interface DiscoverCoachMarkProps {
10- onClick : ( ) => void
8+ onClose : ( ) => void
119}
1210
13- const DiscoverCoachMark = ( { onClick } : DiscoverCoachMarkProps ) => {
14- const deviceType = useDevice ( )
15- const isMobile = deviceType === 'mobile'
11+ const DiscoverCoachMark = ( { onClose } : DiscoverCoachMarkProps ) => {
12+ const handleOverlayClick = ( e : React . MouseEvent | React . TouchEvent ) => {
13+ e . stopPropagation ( )
1614
17- return (
18- < Overlay >
19- < CloseButton >
20- < SvgButton icon = { Cancel } onClick = { onClick } />
21- </ CloseButton >
15+ setTimeout ( ( ) => {
16+ onClose ( )
17+ } , 0 )
18+ }
2219
23- < ContentWrapper $isMobile = { isMobile } >
24- { isMobile && (
25- < CoachMarkCdWrapper >
26- < CdText >
27- < Highlight > CD를 클릭</ Highlight > 하면 < br /> 플레이리스트가 재생돼요
28- </ CdText >
29- < CoachMarkCd >
30- < CoachMarkArrow />
31- < Cd variant = "xxl" bgColor = "none" />
32- </ CoachMarkCd >
33- </ CoachMarkCdWrapper >
34- ) }
35- < Content >
36- < p >
37- 더 많은 플레이리스트를 보려면 < br />
38- < Highlight > 화면을 위로</ Highlight > 올려보세요!
39- </ p >
40- </ Content >
41- < LottieWrapper >
42- < Lottie animationData = { SwipeLottie } loop autoplay style = { { height : 190 } } />
43- </ LottieWrapper >
44- </ ContentWrapper >
20+ return (
21+ < Overlay
22+ onClick = { handleOverlayClick }
23+ onTouchStart = { handleOverlayClick }
24+ onMouseDown = { handleOverlayClick }
25+ >
26+ < Content >
27+ < p >
28+ 더 많은 플레이리스트를 보려면 < br />
29+ < Highlight > 화면을 위로</ Highlight > 올려보세요!
30+ </ p >
31+ </ Content >
32+ < Lottie animationData = { SwipeLottie } loop autoplay style = { { height : 220 } } />
4533 </ Overlay >
4634 )
4735}
@@ -54,73 +42,18 @@ const Overlay = styled.div`
5442 left: 0;
5543 width: 100%;
5644 height: 100dvh;
57- background: rgba(15, 16, 20, 0.68);
58- z-index: 999;
59- `
60-
61- const CloseButton = styled . div `
62- position: absolute;
63- top: 18px;
64- right: 0;
65- z-index: 1001;
66- `
67-
68- const ContentWrapper = styled . div < { $isMobile : boolean } > `
69- position: absolute;
70- left: 50%;
71- transform: translateX(-50%);
45+ background: rgba(15, 16, 20, 0.8);
46+ z-index: ${ ( { theme } ) => theme . Z_INDEX . coachMark } ;
47+ ${ flexColCenter }
7248
73- display: flex;
74- flex-direction: column;
75- align-items: center;
76- width: 100%;
77-
78- top: ${ ( { $isMobile } ) => ( $isMobile ? '64px' : '50%' ) } ;
79- transform: ${ ( { $isMobile } ) => ( $isMobile ? 'translateX(-50%)' : 'translate(-50%, -50%)' ) } ;
49+ pointer-events: auto;
8050`
8151
8252const Content = styled . div `
8353 text-align: center;
8454 ${ ( { theme } ) => theme . FONT . headline1 } ;
85- font-weight: 600;
86-
87- margin-top: 20px;
88- white-space: nowrap;
8955`
9056
9157const Highlight = styled . span `
9258 color: ${ ( { theme } ) => theme . COLOR [ 'primary-normal' ] } ;
9359`
94-
95- const CoachMarkCd = styled . div `
96- position: relative;
97-
98- & svg {
99- position: absolute;
100- right: 0;
101- top: 0;
102- }
103- `
104-
105- const LottieWrapper = styled . div `
106- height: 180px;
107- overflow: hidden;
108- `
109- const CoachMarkCdWrapper = styled . div `
110- position: relative;
111- display: inline-block;
112- padding-top: 40px;
113- `
114-
115- const CdText = styled . p `
116- color: ${ ( { theme } ) => theme . COLOR [ 'gray-50' ] } ;
117- ${ ( { theme } ) => theme . FONT [ 'body1-normal' ] } ;
118- text-align: right;
119- position: absolute;
120-
121- top: -4%;
122- right: 0;
123- margin-bottom: 12px;
124-
125- white-space: nowrap;
126- `
0 commit comments