@daeryun/dr_components 0.1.92 → 0.1.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset/images/header/logo_b.webp +0 -0
- package/dist/asset/images/header/logo_w.webp +0 -0
- package/dist/asset/images/header/military.svg +38 -0
- package/dist/asset/images/header/military_w.svg +38 -0
- package/dist/components/Header/Header.d.ts +4 -0
- package/dist/components/Header/Header.jsx +189 -0
- package/dist/components/Header/Header.stories.d.ts +8 -0
- package/dist/components/Header/Header.stories.jsx +200 -0
- package/dist/components/Header/Header.stories.tsx +209 -0
- package/dist/components/Header/Header.tsx +281 -0
- package/dist/components/Header/Menu.d.ts +4 -0
- package/dist/components/Header/Menu.jsx +10 -0
- package/dist/components/Header/Menu.tsx +29 -0
- package/dist/components/Header/MobileMenu.d.ts +4 -0
- package/dist/components/Header/MobileMenu.jsx +209 -0
- package/dist/components/Header/MobileMenu.tsx +370 -0
- package/dist/components/Header/PCMenu.d.ts +4 -0
- package/dist/components/Header/PCMenu.jsx +130 -0
- package/dist/components/Header/PCMenu.tsx +243 -0
- package/dist/components/Header/main.module.css +150 -0
- package/dist/components/MapFix/AreaImage.jsx +10 -9
- package/dist/components/MapFix/AreaImage.tsx +21 -26
- package/dist/components/MapSection/MapSection.stories.jsx +16 -0
- package/dist/components/MapSection/MapSection.stories.tsx +34 -0
- package/dist/components/categoryView/CategoryView.jsx +1 -1
- package/dist/components/categoryView/CategoryView.tsx +1 -3
- package/dist/components/hook/useBrowser.d.ts +5 -0
- package/dist/components/hook/useBrowser.js +51 -0
- package/dist/components/hook/useBrowser.ts +58 -0
- package/dist/components/hook/useCountNum.d.ts +4 -0
- package/dist/components/hook/useCountNum.jsx +23 -0
- package/dist/components/hook/useCountNum.tsx +28 -0
- package/dist/components/hook/useElementObserve.d.ts +7 -0
- package/dist/components/hook/useElementObserve.js +39 -0
- package/dist/components/hook/useElementObserve.ts +46 -0
- package/dist/components/hook/useScrollRestoration.d.ts +5 -0
- package/dist/components/hook/useScrollRestoration.js +61 -0
- package/dist/components/hook/useScrollRestoration.ts +80 -0
- package/dist/components/hook/useScrollRestorationException.d.ts +2 -0
- package/dist/components/hook/useScrollRestorationException.js +24 -0
- package/dist/components/hook/useScrollRestorationException.ts +30 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.ts +1 -0
- package/dist/components/myCase/MyCase.d.ts +5 -0
- package/dist/components/myCase/MyCase.jsx +26 -0
- package/dist/components/myCase/MyCase.tsx +47 -0
- package/dist/components/routes/gnb.d.ts +11 -0
- package/dist/components/routes/gnb.jsx +165 -0
- package/dist/components/routes/gnb.tsx +172 -0
- package/dist/styles/globals.css +324 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/header.d.ts +53 -0
- package/dist/types/header.js +1 -0
- package/dist/types/header.ts +55 -0
- package/package.json +1 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
import { insert } from '../../lib';
|
|
5
|
+
import * as gtag from '../../lib/gtag';
|
|
6
|
+
import { useRouter } from 'next/router';
|
|
7
|
+
import { savePowerLinkConversion } from '../../lib';
|
|
8
|
+
import MyCase from '../myCase/MyCase';
|
|
9
|
+
import Menu_x from '../../asset/images/header/menu_x.webp';
|
|
10
|
+
import M_sr from '../../asset/images/header/m_sr.webp';
|
|
11
|
+
import M_right from '../../asset/images/header/m_right.webp';
|
|
12
|
+
import Call from '../../asset/images/header/h_call_line_b.webp';
|
|
13
|
+
import { blankArr } from '../../types/header';
|
|
14
|
+
import BrochureBtn from '../BrochureBtn/BrochureBtn';
|
|
15
|
+
const MobileMenu = ({ handleMenuToggle, opacity, menuToggle, routes, tel, keywordArr, logo, isBrochureBtn }) => {
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
const mobile = require('is-mobile');
|
|
18
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
19
|
+
//활성화 메뉴관리
|
|
20
|
+
const currentPath = router.pathname;
|
|
21
|
+
const [activeMenu, setActiveMenu] = useState();
|
|
22
|
+
//검색기능
|
|
23
|
+
const [search, setSearch] = useState('');
|
|
24
|
+
//나의사건검색
|
|
25
|
+
const [isMyCaseOn, setIsMyCaseOn] = useState(false);
|
|
26
|
+
// GA 클릭이벤트
|
|
27
|
+
const menuTelClickMo = () => {
|
|
28
|
+
gtag.event({
|
|
29
|
+
action: 'mobile_menu_tel',
|
|
30
|
+
category: 'menutel',
|
|
31
|
+
label: '모바일메뉴내전화버튼',
|
|
32
|
+
value: '1'
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
// 에이스카운터 전환태그
|
|
36
|
+
const ace_ToptelClick = () => {
|
|
37
|
+
try {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
AM_PL('/m_Toptel');
|
|
40
|
+
}
|
|
41
|
+
catch (e) { }
|
|
42
|
+
};
|
|
43
|
+
// 현재 주소로 활성화
|
|
44
|
+
const findOuterName = (currentPath) => {
|
|
45
|
+
for (const route of routes) {
|
|
46
|
+
if (currentPath === route.path || currentPath.startsWith(route.path + '/')) {
|
|
47
|
+
return route.name;
|
|
48
|
+
}
|
|
49
|
+
for (const nestedRoute of route.routes) {
|
|
50
|
+
if (currentPath === nestedRoute.path || currentPath.startsWith(nestedRoute.path + '/')) {
|
|
51
|
+
return route.name;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return routes[0].name;
|
|
56
|
+
};
|
|
57
|
+
// 클릭시 활성화
|
|
58
|
+
const handleClickForMobile = (e) => {
|
|
59
|
+
setActiveMenu(e.target.textContent);
|
|
60
|
+
};
|
|
61
|
+
//감색기능 엔터
|
|
62
|
+
const handleKeyPressSearch = (e) => {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
if (e.key === 'Enter' && search.length > 0) {
|
|
65
|
+
handleMenuToggle(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`);
|
|
66
|
+
window.open(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`, '_blank');
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//감색기능 클릭
|
|
70
|
+
const handleClickSearch = () => {
|
|
71
|
+
handleMenuToggle(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`);
|
|
72
|
+
window.open(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`, '_blank');
|
|
73
|
+
};
|
|
74
|
+
const handleClickKeyword = (keyword) => {
|
|
75
|
+
//recommend - 추천 검색어 버튼 클릭이면 true
|
|
76
|
+
if (keyword) {
|
|
77
|
+
handleMenuToggle(`https://www.daeryunlaw.com/integrate?tab=전체&search=${keyword}&recommend=true`);
|
|
78
|
+
window.open(`https://www.daeryunlaw.com/integrate?tab=전체&search=${keyword}&recommend=true`, '_blank');
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//나의사건검샛
|
|
82
|
+
const onClickMyCase = () => {
|
|
83
|
+
setIsMyCaseOn(false);
|
|
84
|
+
};
|
|
85
|
+
//페이지 내부에서 쿼리 파라미터 없이 루트 경로로 돌아갈 때 새로고침
|
|
86
|
+
const reloadUrl = (url) => {
|
|
87
|
+
if (router.pathname === url) {
|
|
88
|
+
router.push(url).then(() => {
|
|
89
|
+
router.reload();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
setIsMobile(mobile());
|
|
95
|
+
setActiveMenu(findOuterName(currentPath));
|
|
96
|
+
}, []);
|
|
97
|
+
return (<>
|
|
98
|
+
{isMyCaseOn ? <MyCase onClick={onClickMyCase}/> : <></>}
|
|
99
|
+
|
|
100
|
+
{/*모바일 메뉴 1024px*/}
|
|
101
|
+
{/*<div style={{ opacity }} className={style.main + ' hidden max-lg:block fixed top-0 left-0 w-full h-full'}>*/}
|
|
102
|
+
<div style={{ opacity, zIndex: menuToggle ? 50 : -9999, pointerEvents: menuToggle ? 'auto' : 'none' }} className={' fixed left-0 top-0 hidden h-full w-full max-lg:block'}>
|
|
103
|
+
<div className={'absolute left-0 top-0 h-full w-full bg-black bg-opacity-[55%]'} onClick={() => handleMenuToggle()}></div>
|
|
104
|
+
<span style={{
|
|
105
|
+
//스크롤 숨기기
|
|
106
|
+
msOverflowStyle: 'none',
|
|
107
|
+
scrollbarWidth: 'none'
|
|
108
|
+
}} className={'absolute right-0 top-0 z-0 h-full w-[65%] overflow-y-auto ' +
|
|
109
|
+
//640px
|
|
110
|
+
'bg-white max-sm:w-[100%]'}>
|
|
111
|
+
<nav className={'h-full min-h-[800px] w-full'}>
|
|
112
|
+
{/*세로 800px 이상이면 스크롤가능*/}
|
|
113
|
+
<div className={'flex h-[55%] max-h-[290px] w-full flex-col justify-end border-b-[1px] border-solid border-b-[#F2F2F2] px-[30px] py-[30px] ' +
|
|
114
|
+
//768px
|
|
115
|
+
'max-md:h-[20%] max-md:max-h-[180px] max-md:min-h-[250px]'}>
|
|
116
|
+
{/* x icon */}
|
|
117
|
+
<Image tabIndex={0} src={Menu_x} width={54} height={54} alt={'메뉴'} className={'absolute right-[20px] top-[30px] h-[18px] w-[18px] cursor-pointer ' +
|
|
118
|
+
//768px
|
|
119
|
+
'max-md:h-[15px] max-md:w-[15px]'} draggable={false} onKeyDown={(e) => {
|
|
120
|
+
if (e.key === 'Enter') {
|
|
121
|
+
handleMenuToggle();
|
|
122
|
+
}
|
|
123
|
+
}} onClick={() => handleMenuToggle()}/>
|
|
124
|
+
<span>
|
|
125
|
+
<Link href="/" onClick={() => handleMenuToggle('/')}>
|
|
126
|
+
<Image src={logo} alt={`${process.env.NEXT_PUBLIC_KEYWORD}전문변호사 로고`} width={324} height={50} className={'h-auto w-[200px] ' +
|
|
127
|
+
//768px
|
|
128
|
+
'max-md:w-[155px]'}/>
|
|
129
|
+
</Link>
|
|
130
|
+
<div className={'relative mt-[20px] h-[50px] w-full ' + //768px
|
|
131
|
+
'max-md:h-[40px] '}>
|
|
132
|
+
<input placeholder={'사건분야, 변호사, 법률정보 등을 검색해보세요'} className={'h-full w-full border-[1px] border-solid border-[#285FA7] px-[20px] text-base tracking-[-0.6px] ' +
|
|
133
|
+
//768px
|
|
134
|
+
'max-md:text-sm'} onChange={e => {
|
|
135
|
+
setSearch(e.target.value);
|
|
136
|
+
}} onKeyUp={handleKeyPressSearch}></input>
|
|
137
|
+
<Image src={M_sr} alt={'sr_icon'} width={35} height={34} className={'absolute right-[15px] top-[50%] h-auto w-[20px] translate-y-[-50%] cursor-pointer ' +
|
|
138
|
+
//768px
|
|
139
|
+
'max-md:w-[17px]'} onClick={handleClickSearch}/>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div className={'relative mt-[20px] grid w-full grid-cols-4 gap-2 '}>
|
|
143
|
+
{keywordArr.map((item, index) => (<div key={index} tabIndex={0} className={'cursor-pointer rounded-full border-[1px] border-solid border-[#285FA7] p-1 text-center text-[14px] font-[800] tracking-tighter text-[#285FA7] max-xs:text-[12px] '} onKeyDown={(e) => {
|
|
144
|
+
if (e.key === 'Enter') {
|
|
145
|
+
handleClickKeyword(item);
|
|
146
|
+
}
|
|
147
|
+
}} onClick={() => {
|
|
148
|
+
handleClickKeyword(item);
|
|
149
|
+
}}>
|
|
150
|
+
#{item}
|
|
151
|
+
</div>))}
|
|
152
|
+
</div>
|
|
153
|
+
</span>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
{/*메뉴시작*/}
|
|
157
|
+
<div className={'relative h-[60%] max-h-[600px] w-full bg-[#FCFCFC] py-[30px]'}>
|
|
158
|
+
<div className={'absolute top-0 h-full w-[45%] bg-[#F7F7F7]'}></div>
|
|
159
|
+
<div className={'flex h-full w-full flex-col justify-between'}>
|
|
160
|
+
{routes.map((menu, index) => {
|
|
161
|
+
var _a;
|
|
162
|
+
return (<span key={index} className={'relative w-full'}>
|
|
163
|
+
{/*main menu*/}
|
|
164
|
+
<button type={'button'} className={'h-[35px] w-[48%] flex-shrink-0 translate-x-[15px] rounded-full pl-[20px] text-left text-base font-[800] ' +
|
|
165
|
+
//버튼 활성화상태
|
|
166
|
+
`${activeMenu == menu.name
|
|
167
|
+
? '!bg-[#285FA7] text-white '
|
|
168
|
+
: 'hover:bg-[#EAEAEA]'}`} onClick={handleClickForMobile}>
|
|
169
|
+
{menu.name}
|
|
170
|
+
</button>
|
|
171
|
+
{/*sub menu*/}
|
|
172
|
+
{menu.routes ? (<ul className={'absolute right-0 top-[5px] z-10 flex max-h-[160px] w-[55%] flex-col gap-[2vh] ' +
|
|
173
|
+
`${activeMenu == menu.name ? '' : 'hidden'}`}>
|
|
174
|
+
{(_a = menu.routes) === null || _a === void 0 ? void 0 : _a.map((submenu, index) => (<li key={index} className={' pl-[50px] pr-[30px] '}>
|
|
175
|
+
{submenu.name !== '나의 사건검색' ? (<Link href={submenu.path} className={'flex items-center justify-between text-base text-[#5C5C5C] hover:text-[#333333] '} onClick={() => {
|
|
176
|
+
handleMenuToggle(submenu.path);
|
|
177
|
+
reloadUrl(submenu.path);
|
|
178
|
+
}} target={blankArr.includes(submenu.name) ? '_blank' : '_self'}>
|
|
179
|
+
{submenu.name}
|
|
180
|
+
<Image src={M_right} alt={'arrow_icon'} width={12} height={23} className={'h-auto w-[4px]'}/>
|
|
181
|
+
</Link>) : (<div className={'flex cursor-pointer items-center justify-between text-base text-[#5C5C5C] hover:text-[#333333] '} onClick={() => setIsMyCaseOn(true)}>
|
|
182
|
+
{submenu.name}
|
|
183
|
+
<Image src={M_right} alt={'arrow_icon'} width={12} height={23} className={'h-auto w-[4px]'}/>
|
|
184
|
+
</div>)}
|
|
185
|
+
</li>))}
|
|
186
|
+
</ul>) : ('')}
|
|
187
|
+
</span>);
|
|
188
|
+
})}
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
{/*전화번호*/}
|
|
192
|
+
<div className={'mt-[30px] flex w-full justify-start pb-[100px] max-2xs:flex-col'}>
|
|
193
|
+
<Link href={`tel:${tel}`} onClick={() => {
|
|
194
|
+
insert('call', isMobile);
|
|
195
|
+
savePowerLinkConversion('call', isMobile);
|
|
196
|
+
menuTelClickMo();
|
|
197
|
+
ace_ToptelClick();
|
|
198
|
+
}} className={'ml-[30px] flex w-fit items-center justify-end gap-[10px] text-lg font-black'}>
|
|
199
|
+
<Image src={Call} width={57} height={57} alt={'전화상담'} className={'h-auto w-[30px]'}/>
|
|
200
|
+
{tel}
|
|
201
|
+
</Link>
|
|
202
|
+
{isBrochureBtn ? (<BrochureBtn width={'280px'} height={'58px'} className={'scale-75 max-md:-mx-[23px] max-xs:scale-[0.7] max-2xs:-mx-[15px] max-2xs:mt-1 '}/>) : (<></>)}
|
|
203
|
+
</div>
|
|
204
|
+
</nav>
|
|
205
|
+
</span>
|
|
206
|
+
</div>
|
|
207
|
+
</>);
|
|
208
|
+
};
|
|
209
|
+
export default MobileMenu;
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
import { insert } from '../../lib';
|
|
5
|
+
import * as gtag from '../../lib/gtag';
|
|
6
|
+
import { useRouter } from 'next/router';
|
|
7
|
+
import { savePowerLinkConversion } from '../../lib';
|
|
8
|
+
import MyCase from '../myCase/MyCase';
|
|
9
|
+
import Menu_x from '../../asset/images/header/menu_x.webp';
|
|
10
|
+
import M_sr from '../../asset/images/header/m_sr.webp';
|
|
11
|
+
import M_right from '../../asset/images/header/m_right.webp';
|
|
12
|
+
import Call from '../../asset/images/header/h_call_line_b.webp';
|
|
13
|
+
import { blankArr, IMobileMenuType } from '../../types/header';
|
|
14
|
+
import BrochureBtn from '../BrochureBtn/BrochureBtn';
|
|
15
|
+
|
|
16
|
+
const MobileMenu = ({
|
|
17
|
+
handleMenuToggle,
|
|
18
|
+
opacity,
|
|
19
|
+
menuToggle,
|
|
20
|
+
routes,
|
|
21
|
+
tel,
|
|
22
|
+
keywordArr,
|
|
23
|
+
logo,
|
|
24
|
+
isBrochureBtn
|
|
25
|
+
}: IMobileMenuType) => {
|
|
26
|
+
const router = useRouter();
|
|
27
|
+
const mobile = require('is-mobile');
|
|
28
|
+
const [isMobile, setIsMobile] = useState<boolean>(false);
|
|
29
|
+
|
|
30
|
+
//활성화 메뉴관리
|
|
31
|
+
const currentPath = router.pathname;
|
|
32
|
+
const [activeMenu, setActiveMenu] = useState<string>();
|
|
33
|
+
|
|
34
|
+
//검색기능
|
|
35
|
+
const [search, setSearch] = useState<string>('');
|
|
36
|
+
|
|
37
|
+
//나의사건검색
|
|
38
|
+
const [isMyCaseOn, setIsMyCaseOn] = useState<boolean>(false);
|
|
39
|
+
|
|
40
|
+
// GA 클릭이벤트
|
|
41
|
+
const menuTelClickMo = () => {
|
|
42
|
+
gtag.event({
|
|
43
|
+
action: 'mobile_menu_tel',
|
|
44
|
+
category: 'menutel',
|
|
45
|
+
label: '모바일메뉴내전화버튼',
|
|
46
|
+
value: '1'
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// 에이스카운터 전환태그
|
|
51
|
+
const ace_ToptelClick = () => {
|
|
52
|
+
try {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
AM_PL('/m_Toptel');
|
|
55
|
+
} catch (e) {}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// 현재 주소로 활성화
|
|
59
|
+
const findOuterName = (currentPath: string) => {
|
|
60
|
+
for (const route of routes) {
|
|
61
|
+
if (currentPath === route.path || currentPath.startsWith(route.path + '/')) {
|
|
62
|
+
return route.name;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
for (const nestedRoute of route.routes) {
|
|
66
|
+
if (currentPath === nestedRoute.path || currentPath.startsWith(nestedRoute.path + '/')) {
|
|
67
|
+
return route.name;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return routes[0].name;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// 클릭시 활성화
|
|
75
|
+
const handleClickForMobile = (e: any) => {
|
|
76
|
+
setActiveMenu(e.target.textContent);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//감색기능 엔터
|
|
80
|
+
const handleKeyPressSearch = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
if (e.key === 'Enter' && search.length > 0) {
|
|
83
|
+
handleMenuToggle(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`);
|
|
84
|
+
window.open(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`, '_blank');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
//감색기능 클릭
|
|
89
|
+
const handleClickSearch = () => {
|
|
90
|
+
handleMenuToggle(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`);
|
|
91
|
+
window.open(`https://www.daeryunlaw.com/integrate?tab=전체&search=${search}`, '_blank');
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const handleClickKeyword = (keyword: string) => {
|
|
95
|
+
//recommend - 추천 검색어 버튼 클릭이면 true
|
|
96
|
+
if (keyword) {
|
|
97
|
+
handleMenuToggle(`https://www.daeryunlaw.com/integrate?tab=전체&search=${keyword}&recommend=true`);
|
|
98
|
+
window.open(`https://www.daeryunlaw.com/integrate?tab=전체&search=${keyword}&recommend=true`, '_blank');
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
//나의사건검샛
|
|
103
|
+
const onClickMyCase = () => {
|
|
104
|
+
setIsMyCaseOn(false);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
//페이지 내부에서 쿼리 파라미터 없이 루트 경로로 돌아갈 때 새로고침
|
|
108
|
+
const reloadUrl = (url: string) => {
|
|
109
|
+
if (router.pathname === url) {
|
|
110
|
+
router.push(url).then(() => {
|
|
111
|
+
router.reload();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
setIsMobile(mobile());
|
|
118
|
+
setActiveMenu(findOuterName(currentPath));
|
|
119
|
+
}, []);
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
{isMyCaseOn ? <MyCase onClick={onClickMyCase} /> : <></>}
|
|
124
|
+
|
|
125
|
+
{/*모바일 메뉴 1024px*/}
|
|
126
|
+
{/*<div style={{ opacity }} className={style.main + ' hidden max-lg:block fixed top-0 left-0 w-full h-full'}>*/}
|
|
127
|
+
<div
|
|
128
|
+
style={{ opacity, zIndex: menuToggle ? 50 : -9999, pointerEvents: menuToggle ? 'auto' : 'none' }}
|
|
129
|
+
className={' fixed left-0 top-0 hidden h-full w-full max-lg:block'}
|
|
130
|
+
>
|
|
131
|
+
<div
|
|
132
|
+
className={'absolute left-0 top-0 h-full w-full bg-black bg-opacity-[55%]'}
|
|
133
|
+
onClick={() => handleMenuToggle()}
|
|
134
|
+
></div>
|
|
135
|
+
<span
|
|
136
|
+
style={{
|
|
137
|
+
//스크롤 숨기기
|
|
138
|
+
msOverflowStyle: 'none',
|
|
139
|
+
scrollbarWidth: 'none'
|
|
140
|
+
}}
|
|
141
|
+
className={
|
|
142
|
+
'absolute right-0 top-0 z-0 h-full w-[65%] overflow-y-auto ' +
|
|
143
|
+
//640px
|
|
144
|
+
'bg-white max-sm:w-[100%]'
|
|
145
|
+
}
|
|
146
|
+
>
|
|
147
|
+
<nav className={'h-full min-h-[800px] w-full'}>
|
|
148
|
+
{/*세로 800px 이상이면 스크롤가능*/}
|
|
149
|
+
<div
|
|
150
|
+
className={
|
|
151
|
+
'flex h-[55%] max-h-[290px] w-full flex-col justify-end border-b-[1px] border-solid border-b-[#F2F2F2] px-[30px] py-[30px] ' +
|
|
152
|
+
//768px
|
|
153
|
+
'max-md:h-[20%] max-md:max-h-[180px] max-md:min-h-[250px]'
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
{/* x icon */}
|
|
157
|
+
<Image
|
|
158
|
+
tabIndex={0}
|
|
159
|
+
src={Menu_x}
|
|
160
|
+
width={54}
|
|
161
|
+
height={54}
|
|
162
|
+
alt={'메뉴'}
|
|
163
|
+
className={
|
|
164
|
+
'absolute right-[20px] top-[30px] h-[18px] w-[18px] cursor-pointer ' +
|
|
165
|
+
//768px
|
|
166
|
+
'max-md:h-[15px] max-md:w-[15px]'
|
|
167
|
+
}
|
|
168
|
+
draggable={false}
|
|
169
|
+
onKeyDown={(e: any) => {
|
|
170
|
+
if (e.key === 'Enter') {
|
|
171
|
+
handleMenuToggle();
|
|
172
|
+
}
|
|
173
|
+
}}
|
|
174
|
+
onClick={() => handleMenuToggle()}
|
|
175
|
+
/>
|
|
176
|
+
<span>
|
|
177
|
+
<Link href="/" onClick={() => handleMenuToggle('/')}>
|
|
178
|
+
<Image
|
|
179
|
+
src={logo}
|
|
180
|
+
alt={`${process.env.NEXT_PUBLIC_KEYWORD}전문변호사 로고`}
|
|
181
|
+
width={324}
|
|
182
|
+
height={50}
|
|
183
|
+
className={
|
|
184
|
+
'h-auto w-[200px] ' +
|
|
185
|
+
//768px
|
|
186
|
+
'max-md:w-[155px]'
|
|
187
|
+
}
|
|
188
|
+
/>
|
|
189
|
+
</Link>
|
|
190
|
+
<div
|
|
191
|
+
className={
|
|
192
|
+
'relative mt-[20px] h-[50px] w-full ' + //768px
|
|
193
|
+
'max-md:h-[40px] '
|
|
194
|
+
}
|
|
195
|
+
>
|
|
196
|
+
<input
|
|
197
|
+
placeholder={'사건분야, 변호사, 법률정보 등을 검색해보세요'}
|
|
198
|
+
className={
|
|
199
|
+
'h-full w-full border-[1px] border-solid border-[#285FA7] px-[20px] text-base tracking-[-0.6px] ' +
|
|
200
|
+
//768px
|
|
201
|
+
'max-md:text-sm'
|
|
202
|
+
}
|
|
203
|
+
onChange={e => {
|
|
204
|
+
setSearch(e.target.value);
|
|
205
|
+
}}
|
|
206
|
+
onKeyUp={handleKeyPressSearch}
|
|
207
|
+
></input>
|
|
208
|
+
<Image
|
|
209
|
+
src={M_sr}
|
|
210
|
+
alt={'sr_icon'}
|
|
211
|
+
width={35}
|
|
212
|
+
height={34}
|
|
213
|
+
className={
|
|
214
|
+
'absolute right-[15px] top-[50%] h-auto w-[20px] translate-y-[-50%] cursor-pointer ' +
|
|
215
|
+
//768px
|
|
216
|
+
'max-md:w-[17px]'
|
|
217
|
+
}
|
|
218
|
+
onClick={handleClickSearch}
|
|
219
|
+
/>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div className={'relative mt-[20px] grid w-full grid-cols-4 gap-2 '}>
|
|
223
|
+
{keywordArr.map((item: string, index: number) => (
|
|
224
|
+
<div
|
|
225
|
+
key={index}
|
|
226
|
+
tabIndex={0}
|
|
227
|
+
className={
|
|
228
|
+
'cursor-pointer rounded-full border-[1px] border-solid border-[#285FA7] p-1 text-center text-[14px] font-[800] tracking-tighter text-[#285FA7] max-xs:text-[12px] '
|
|
229
|
+
}
|
|
230
|
+
onKeyDown={(e: any) => {
|
|
231
|
+
if (e.key === 'Enter') {
|
|
232
|
+
handleClickKeyword(item);
|
|
233
|
+
}
|
|
234
|
+
}}
|
|
235
|
+
onClick={() => {
|
|
236
|
+
handleClickKeyword(item);
|
|
237
|
+
}}
|
|
238
|
+
>
|
|
239
|
+
#{item}
|
|
240
|
+
</div>
|
|
241
|
+
))}
|
|
242
|
+
</div>
|
|
243
|
+
</span>
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
{/*메뉴시작*/}
|
|
247
|
+
<div className={'relative h-[60%] max-h-[600px] w-full bg-[#FCFCFC] py-[30px]'}>
|
|
248
|
+
<div className={'absolute top-0 h-full w-[45%] bg-[#F7F7F7]'}></div>
|
|
249
|
+
<div className={'flex h-full w-full flex-col justify-between'}>
|
|
250
|
+
{routes.map((menu, index) => (
|
|
251
|
+
<span key={index} className={'relative w-full'}>
|
|
252
|
+
{/*main menu*/}
|
|
253
|
+
<button
|
|
254
|
+
type={'button'}
|
|
255
|
+
className={
|
|
256
|
+
'h-[35px] w-[48%] flex-shrink-0 translate-x-[15px] rounded-full pl-[20px] text-left text-base font-[800] ' +
|
|
257
|
+
//버튼 활성화상태
|
|
258
|
+
`${
|
|
259
|
+
activeMenu == menu.name
|
|
260
|
+
? '!bg-[#285FA7] text-white '
|
|
261
|
+
: 'hover:bg-[#EAEAEA]'
|
|
262
|
+
}`
|
|
263
|
+
}
|
|
264
|
+
onClick={handleClickForMobile}
|
|
265
|
+
>
|
|
266
|
+
{menu.name}
|
|
267
|
+
</button>
|
|
268
|
+
{/*sub menu*/}
|
|
269
|
+
{menu.routes ? (
|
|
270
|
+
<ul
|
|
271
|
+
className={
|
|
272
|
+
'absolute right-0 top-[5px] z-10 flex max-h-[160px] w-[55%] flex-col gap-[2vh] ' +
|
|
273
|
+
`${activeMenu == menu.name ? '' : 'hidden'}`
|
|
274
|
+
}
|
|
275
|
+
>
|
|
276
|
+
{menu.routes?.map((submenu, index) => (
|
|
277
|
+
<li key={index} className={' pl-[50px] pr-[30px] '}>
|
|
278
|
+
{submenu.name !== '나의 사건검색' ? (
|
|
279
|
+
<Link
|
|
280
|
+
href={submenu.path}
|
|
281
|
+
className={
|
|
282
|
+
'flex items-center justify-between text-base text-[#5C5C5C] hover:text-[#333333] '
|
|
283
|
+
}
|
|
284
|
+
onClick={() => {
|
|
285
|
+
handleMenuToggle(submenu.path);
|
|
286
|
+
reloadUrl(submenu.path);
|
|
287
|
+
}}
|
|
288
|
+
target={
|
|
289
|
+
blankArr.includes(submenu.name) ? '_blank' : '_self'
|
|
290
|
+
}
|
|
291
|
+
>
|
|
292
|
+
{submenu.name}
|
|
293
|
+
<Image
|
|
294
|
+
src={M_right}
|
|
295
|
+
alt={'arrow_icon'}
|
|
296
|
+
width={12}
|
|
297
|
+
height={23}
|
|
298
|
+
className={'h-auto w-[4px]'}
|
|
299
|
+
/>
|
|
300
|
+
</Link>
|
|
301
|
+
) : (
|
|
302
|
+
<div
|
|
303
|
+
className={
|
|
304
|
+
'flex cursor-pointer items-center justify-between text-base text-[#5C5C5C] hover:text-[#333333] '
|
|
305
|
+
}
|
|
306
|
+
onClick={() => setIsMyCaseOn(true)}
|
|
307
|
+
>
|
|
308
|
+
{submenu.name}
|
|
309
|
+
<Image
|
|
310
|
+
src={M_right}
|
|
311
|
+
alt={'arrow_icon'}
|
|
312
|
+
width={12}
|
|
313
|
+
height={23}
|
|
314
|
+
className={'h-auto w-[4px]'}
|
|
315
|
+
/>
|
|
316
|
+
</div>
|
|
317
|
+
)}
|
|
318
|
+
</li>
|
|
319
|
+
))}
|
|
320
|
+
</ul>
|
|
321
|
+
) : (
|
|
322
|
+
''
|
|
323
|
+
)}
|
|
324
|
+
</span>
|
|
325
|
+
))}
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
{/*전화번호*/}
|
|
329
|
+
<div className={'mt-[30px] flex w-full justify-start pb-[100px] max-2xs:flex-col'}>
|
|
330
|
+
<Link
|
|
331
|
+
href={`tel:${tel}`}
|
|
332
|
+
onClick={() => {
|
|
333
|
+
insert('call', isMobile);
|
|
334
|
+
savePowerLinkConversion('call', isMobile);
|
|
335
|
+
menuTelClickMo();
|
|
336
|
+
ace_ToptelClick();
|
|
337
|
+
}}
|
|
338
|
+
className={
|
|
339
|
+
'ml-[30px] flex w-fit items-center justify-end gap-[10px] text-lg font-black'
|
|
340
|
+
}
|
|
341
|
+
>
|
|
342
|
+
<Image
|
|
343
|
+
src={Call}
|
|
344
|
+
width={57}
|
|
345
|
+
height={57}
|
|
346
|
+
alt={'전화상담'}
|
|
347
|
+
className={'h-auto w-[30px]'}
|
|
348
|
+
/>
|
|
349
|
+
{tel}
|
|
350
|
+
</Link>
|
|
351
|
+
{isBrochureBtn ? (
|
|
352
|
+
<BrochureBtn
|
|
353
|
+
width={'280px'}
|
|
354
|
+
height={'58px'}
|
|
355
|
+
className={
|
|
356
|
+
'scale-75 max-md:-mx-[23px] max-xs:scale-[0.7] max-2xs:-mx-[15px] max-2xs:mt-1 '
|
|
357
|
+
}
|
|
358
|
+
/>
|
|
359
|
+
) : (
|
|
360
|
+
<></>
|
|
361
|
+
)}
|
|
362
|
+
</div>
|
|
363
|
+
</nav>
|
|
364
|
+
</span>
|
|
365
|
+
</div>
|
|
366
|
+
</>
|
|
367
|
+
);
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export default MobileMenu;
|