@daeryun/dr_components 0.2.36 → 0.2.37

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