@daeryun/dr_components 0.1.84 → 0.1.86

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.
Files changed (28) hide show
  1. package/dist/asset/images/choice/choice_call.webp +0 -0
  2. package/dist/asset/images/choice/choice_kakao.webp +0 -0
  3. package/dist/asset/images/choice/choice_stepIcon_01.webp +0 -0
  4. package/dist/asset/images/choice/choice_stepIcon_02.webp +0 -0
  5. package/dist/asset/images/choice/choice_stepIcon_03.webp +0 -0
  6. package/dist/asset/images/choice/choice_stepIcon_04.webp +0 -0
  7. package/dist/asset/images/choice/choice_tri.webp +0 -0
  8. package/dist/asset/images/choice/mt_icon.svg +16 -0
  9. package/dist/asset/images/choice/new_choice_consult.webp +0 -0
  10. package/dist/asset/images/choice/new_choice_consulting.webp +0 -0
  11. package/dist/asset/images/fix/call_m.webp +0 -0
  12. package/dist/asset/images/fix/kakao_m.webp +0 -0
  13. package/dist/asset/images/fix/online_m.webp +0 -0
  14. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  15. package/dist/components/Fix/index.jsx +287 -105
  16. package/dist/components/Fix/index.tsx +532 -210
  17. package/dist/components/page/Choice/Choice.d.ts +8 -0
  18. package/dist/components/page/Choice/Choice.jsx +640 -0
  19. package/dist/components/page/Choice/Choice.stories.d.ts +6 -0
  20. package/dist/components/page/Choice/Choice.stories.jsx +51 -0
  21. package/dist/components/page/Choice/Choice.stories.tsx +62 -0
  22. package/dist/components/page/Choice/Choice.tsx +972 -0
  23. package/dist/components/page/index.d.ts +0 -0
  24. package/dist/components/page/index.js +1 -0
  25. package/dist/components/page/index.ts +0 -0
  26. package/dist/styles/globals.css +1129 -37
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import Link from 'next/link';
2
- import React, { useEffect, useRef, useState } from 'react';
2
+ import React, { RefObject, useEffect, useRef, useState } from 'react';
3
3
  import Image from 'next/image';
4
4
  import { insert } from '../../lib';
5
5
  import * as gtag from '../../lib/gtag';
6
6
  import { savePowerLinkConversion } from '../../lib';
7
- import style from './index.module.css';
8
7
  import { useRouter } from 'next/router';
8
+ import useBrowser from '../common/hook/useBrowser';
9
9
 
10
10
  import OnlineIcon from '../../asset/images/fix/online.webp';
11
11
  import KakaoIcon from '../../asset/images/fix/kakao.webp';
@@ -13,23 +13,121 @@ import CallIcon from '../../asset/images/fix/call.webp';
13
13
  import Call2Icon from '../../asset/images/fix/call2.webp';
14
14
  import MenuXIcon from '../../asset/images/fix/menu_x.webp';
15
15
  import ArrowIcon from '../../asset/images/fix/arrow.webp';
16
+ import OnlineIconM from '../../asset/images/fix/online_m.webp';
17
+ import KakaoIconM from '../../asset/images/fix/kakao_m.webp';
18
+ import CallIconM from '../../asset/images/fix/call_m.webp';
16
19
 
17
- const Fix = (props: {
18
- tel: string;
19
- aceUrl?: string;
20
- // onAceMobileTelClick?: () => void;
21
- // onAcePcTelClick?: () => void;
22
- // onAceMobileKakaoClick?: () => void;
23
- // onAcePcKakaoClick?: () => void;
24
- }) => {
20
+ const Fix = (props: { tel: string; aceUrl?: string }) => {
25
21
  const mobile = require('is-mobile');
26
22
  const [isMobile, setIsMobile] = useState<boolean>(false);
27
23
  // const [isTop, setIsTop] = useState(true);
24
+ //온라인상담, 전화상담
25
+ const [viewOnline, setViewOnline] = useState<boolean>(false);
26
+ const [viewCall, setViewCall] = useState<boolean>(false);
28
27
  const onlineRef = useRef<HTMLDivElement>(null);
29
28
  const callRef = useRef<HTMLDivElement>(null);
29
+ const { width } = useBrowser();
30
+
31
+ //모바일 액티브
32
+ const [activeNum, setActiveNum] = useState(0);
33
+ const [isHovered, setIsHovered] = useState(false);
30
34
 
31
35
  const router = useRouter();
32
36
 
37
+ const handleCancel = (ref: RefObject<HTMLDivElement>, type: 'online' | 'call') => {
38
+ if (ref.current) {
39
+ ref.current.style.opacity = '0';
40
+ }
41
+ if (type === 'call') document.getElementById('callBtn')?.focus();
42
+ else if (type === 'online') document.getElementById('onlineBtn')?.focus();
43
+ setTimeout(() => {
44
+ if (type === 'call') {
45
+ setViewCall(false);
46
+ } else if (type === 'online') {
47
+ document.getElementById('onlineBtn')?.focus();
48
+ setViewOnline(false);
49
+ }
50
+ }, 400);
51
+ };
52
+
53
+ const onClickConsult = () => {
54
+ if (isMobile) {
55
+ mConsultClick();
56
+ } else {
57
+ pcConsultClick();
58
+ }
59
+ };
60
+
61
+ const onConsultCompClick = () => {
62
+ if (isMobile) {
63
+ mConsultCompClick();
64
+ } else {
65
+ pcConsultCompClick();
66
+ }
67
+ };
68
+
69
+ const onConsultPersonalClick = () => {
70
+ if (isMobile) {
71
+ mConsultPersonalClick();
72
+ } else {
73
+ pcConsultPersonalClick();
74
+ }
75
+ };
76
+
77
+ const pcConsultClick = () => {
78
+ gtag.event({
79
+ action: 'pc_fix_consult',
80
+ category: 'fix_consult',
81
+ label: '피씨온라인예약클릭',
82
+ value: '1'
83
+ });
84
+ };
85
+
86
+ const mConsultClick = () => {
87
+ gtag.event({
88
+ action: 'mobile_fix_consult',
89
+ category: 'fix_consult',
90
+ label: '모바일온라인예약클릭',
91
+ value: '1'
92
+ });
93
+ };
94
+
95
+ const pcConsultCompClick = () => {
96
+ gtag.event({
97
+ action: 'pc_fix_comp_consult',
98
+ category: 'fix_consult',
99
+ label: '피씨온라인기업상담클릭',
100
+ value: '1'
101
+ });
102
+ };
103
+
104
+ const mConsultCompClick = () => {
105
+ gtag.event({
106
+ action: 'mobile_fix_comp_consult',
107
+ category: 'fix_consult',
108
+ label: '모바일온라인기업상담클릭',
109
+ value: '1'
110
+ });
111
+ };
112
+
113
+ const pcConsultPersonalClick = () => {
114
+ gtag.event({
115
+ action: 'pc_fix_personal_consult',
116
+ category: 'fix_consult',
117
+ label: '피씨온라인개인상담클릭',
118
+ value: '1'
119
+ });
120
+ };
121
+
122
+ const mConsultPersonalClick = () => {
123
+ gtag.event({
124
+ action: 'mobile_fix_personal_consult',
125
+ category: 'fix_consult',
126
+ label: '모바일온라인개인상담클릭',
127
+ value: '1'
128
+ });
129
+ };
130
+
33
131
  const onClickKakao = () => {
34
132
  insert('kakao', isMobile);
35
133
  savePowerLinkConversion('kakao', isMobile);
@@ -133,6 +231,28 @@ const Fix = (props: {
133
231
  setIsMobile(is_mobile);
134
232
  }, []);
135
233
 
234
+ useEffect(() => {
235
+ let mainLoop: NodeJS.Timeout | undefined;
236
+
237
+ const resetInterval = () => {
238
+ if (mainLoop) clearInterval(mainLoop);
239
+ if (!isHovered) {
240
+ // 호버 중이 아닐 때만 인터벌 설정
241
+ mainLoop = setInterval(() => {
242
+ console.log(activeNum);
243
+ if (activeNum >= 2) {
244
+ setActiveNum(0);
245
+ } else {
246
+ setActiveNum(prev => prev + 1);
247
+ }
248
+ }, 2000);
249
+ }
250
+ };
251
+ resetInterval();
252
+
253
+ return () => clearInterval(mainLoop);
254
+ }, [activeNum, isHovered]);
255
+
136
256
  return (
137
257
  <>
138
258
  <div
@@ -140,16 +260,26 @@ const Fix = (props: {
140
260
  // (isTop ? ' hidden ' : '') +
141
261
  ' fixed bottom-[6.5%] right-[25px] z-[2000] w-fit font-[SUIT] ' +
142
262
  ' max-5xl:bottom-[4%] ' +
143
- ' max-lg:relative max-lg:bottom-0 max-lg:right-0 max-lg:w-full'
263
+ ' max-lg:relative max-lg:bottom-0 max-lg:right-0 max-lg:w-full max-lg:rounded-t-[20px] max-lg:shadow-[0_-2px_20px_0_rgba(0,0,0,0.08)] '
144
264
  }
145
265
  >
266
+ {/*모바일용 원*/}
267
+ <div
268
+ className={
269
+ 'absolute -top-[10px] aspect-square w-[50px] translate-x-[-50%] rounded-full bg-white transition-[left] duration-300 ease-out lg:hidden '
270
+ }
271
+ style={{
272
+ left: `calc(((100%/3)/2)*${activeNum * 2 + 1})`
273
+ }}
274
+ />
275
+
146
276
  {/*Fix*/}
147
277
 
148
278
  <div
149
279
  className={
150
280
  'relative z-20 h-[330px] w-[100px] overflow-hidden rounded-full shadow-[0_4px_8px_0_rgba(0,0,0,0.1)] ' +
151
281
  'max-5xl:h-[250px] max-5xl:w-[75px] ' +
152
- 'max-lg:h-[65px] max-lg:w-full max-lg:rounded-none max-lg:shadow-[0_-2px_20px_0_rgba(0,0,0,0.08)] '
282
+ 'max-lg:h-[70px] max-lg:w-full max-lg:overflow-visible max-lg:shadow-none '
153
283
  }
154
284
  >
155
285
  <div
@@ -159,218 +289,410 @@ const Fix = (props: {
159
289
  >
160
290
  Quick Menu
161
291
  </div>
162
- <div
163
- className={
164
- 'leading-1 flex h-full w-full flex-col items-center gap-y-[29px] bg-[#fff] py-[15px] pb-[20px] text-[14px] font-[600] tracking-[-0.7px] text-[#2B2B2B] ' +
165
- ' max-5xl:gap-y-[13px] max-5xl:py-[13px] max-5xl:text-[13px] ' +
166
- ' max-lg:flex-row max-lg:pb-[18px] max-lg:pt-[20px] max-lg:text-[13px] '
167
- }
168
- >
169
- {/*온라인 예약 버튼*/}
292
+ {width >= 1024 ? (
170
293
  <div
171
- className={'flex w-full cursor-pointer flex-col items-center'}
172
- onClick={() => {
173
- callRef.current?.classList.remove(style.fadeIn);
174
- callRef.current?.classList.remove(style.fadeOut);
175
- onlineRef.current?.classList.remove(style.fadeOut);
176
- onlineRef.current?.classList.add(style.fadeIn);
177
- }}
294
+ className={
295
+ 'leading-1 flex h-full w-full flex-col items-center gap-y-[29px] bg-[#fff] py-[15px] pb-[20px] text-[14px] font-[600] tracking-[-0.7px] text-[#2B2B2B] ' +
296
+ ' max-5xl:gap-y-[13px] max-5xl:py-[13px] max-5xl:text-[13px] ' +
297
+ ' max-lg:flex-row max-lg:pb-[18px] max-lg:pt-[20px] max-lg:text-[13px] ' +
298
+ ' max-lg:hidden'
299
+ }
178
300
  >
179
- <Image
180
- src={OnlineIcon}
181
- alt={'online icon'}
182
- width={33}
183
- height={38}
184
- className={'h-auto w-[33px] max-5xl:w-[23px] max-lg:w-[25px] lg:mb-[3px] 5xl:mb-[5px] '}
185
- />
186
- 온라인예약
301
+ {/*온라인 예약 버튼*/}
302
+ <div
303
+ className={'flex w-full cursor-pointer flex-col items-center'}
304
+ onClick={() => {
305
+ onClickConsult();
306
+ setViewOnline(true);
307
+ }}
308
+ >
309
+ <Image
310
+ src={OnlineIcon}
311
+ alt={'online icon'}
312
+ width={33}
313
+ height={38}
314
+ className={
315
+ 'h-auto w-[33px] max-5xl:w-[23px] max-lg:w-[25px] lg:mb-[3px] 5xl:mb-[5px] '
316
+ }
317
+ />
318
+ 온라인예약
319
+ </div>
320
+ {/*카톡 예약 버튼*/}
321
+ <Link
322
+ href="https://pf.kakao.com/_xgxoTlK/chat"
323
+ target={'_blank'}
324
+ className={'flex w-full cursor-pointer flex-col items-center'}
325
+ onClick={onClickKakao}
326
+ >
327
+ <Image
328
+ src={KakaoIcon}
329
+ alt={'kakao icon'}
330
+ width={33}
331
+ height={31}
332
+ className={
333
+ 'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px] '
334
+ }
335
+ />
336
+ 카톡예약
337
+ </Link>
338
+ {/*전화 예약 버튼*/}
339
+ <div
340
+ className={'flex w-full cursor-pointer flex-col items-center'}
341
+ onClick={() => {
342
+ setViewCall(true);
343
+ }}
344
+ >
345
+ <Image
346
+ src={CallIcon}
347
+ alt={'call icon'}
348
+ width={33}
349
+ height={33}
350
+ className={
351
+ 'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px]'
352
+ }
353
+ />
354
+ 전화예약
355
+ </div>
187
356
  </div>
188
- {/*카톡 예약 버튼*/}
189
- <Link
190
- href="https://pf.kakao.com/_xgxoTlK/chat"
191
- target={'_blank'}
192
- className={'flex w-full cursor-pointer flex-col items-center'}
193
- onClick={onClickKakao}
194
- >
195
- <Image
196
- src={KakaoIcon}
197
- alt={'kakao icon'}
198
- width={33}
199
- height={31}
200
- className={
201
- 'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px] '
202
- }
203
- />
204
- 카톡예약
205
- </Link>
206
- {/*전화 예약 버튼*/}
357
+ ) : (
207
358
  <div
208
- className={'flex w-full cursor-pointer flex-col items-center'}
209
- onClick={() => {
210
- onlineRef.current?.classList.remove(style.fadeIn);
211
- onlineRef.current?.classList.remove(style.fadeOut);
212
- callRef.current?.classList.remove(style.fadeOut);
213
- callRef.current?.classList.add(style.fadeIn);
214
- }}
359
+ className={
360
+ 'flex h-full w-full rounded-t-[20px] bg-white pb-[5px] text-[13px] font-[600] leading-none text-[#2B2B2B] lg:hidden '
361
+ }
215
362
  >
216
- <Image
217
- src={CallIcon}
218
- alt={'call icon'}
219
- width={33}
220
- height={33}
221
- className={'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px]'}
222
- />
223
- 전화예약
363
+ {/*온라인 예약 버튼*/}
364
+ <button
365
+ className={'relative z-10 flex w-full flex-col items-center justify-center gap-[8px]'}
366
+ onClick={() => {
367
+ onClickConsult();
368
+ setViewOnline(true);
369
+ }}
370
+ tabIndex={0}
371
+ aria-label="온라인 예약"
372
+ id={'onlineBtn'}
373
+ onMouseEnter={() => {
374
+ setActiveNum(0);
375
+ setIsHovered(true);
376
+ }}
377
+ onMouseLeave={() => setIsHovered(false)}
378
+ >
379
+ <div
380
+ className={
381
+ 'absolute top-[-5px] z-0 aspect-square w-[40px] scale-50 rounded-full bg-[#AE0E36] delay-[150ms] duration-300 ' +
382
+ 'transition-[opacity,transform] ' +
383
+ `${activeNum === 0 ? 'scale-[1] opacity-100' : 'opacity-0 transition-none delay-0'}`
384
+ }
385
+ />
386
+ <span
387
+ className={
388
+ 'relative h-[21px] w-[21px] transition-[filter,transform] delay-[150ms] duration-300 ' +
389
+ `${activeNum === 0 ? 'translate-y-[-8px] brightness-[300]' : 'brightness-[0] transition-none delay-0'}`
390
+ }
391
+ >
392
+ <Image
393
+ src={OnlineIconM}
394
+ alt={''}
395
+ fill
396
+ className={'h-full w-full object-contain '}
397
+ />
398
+ </span>
399
+ <p
400
+ className={
401
+ 'z-10 tracking-[-0.6px] transition-[color,font-weight] delay-[150ms] duration-300 ' +
402
+ `${activeNum === 0 ? 'font-[800] text-[#AE0E36]' : ' transition-none delay-0'}`
403
+ }
404
+ >
405
+ 온라인예약
406
+ </p>
407
+ </button>
408
+ {/*카톡 예약 버튼*/}
409
+ <Link
410
+ href="https://pf.kakao.com/_xgxoTlK/chat"
411
+ title={'새창열림'}
412
+ target={'_blank'}
413
+ className={'flex w-full flex-col items-center justify-center gap-[8px]'}
414
+ onClick={onClickKakao}
415
+ tabIndex={0}
416
+ aria-label="카카오톡 예약"
417
+ onMouseEnter={() => {
418
+ setActiveNum(1);
419
+ setIsHovered(true);
420
+ }}
421
+ onMouseLeave={() => setIsHovered(false)}
422
+ >
423
+ <div
424
+ className={
425
+ 'absolute top-[-5px] z-0 aspect-square w-[40px] scale-50 rounded-full bg-[#AE0E36] delay-[150ms] duration-300 ' +
426
+ 'transition-[opacity,transform] ' +
427
+ `${activeNum === 1 ? 'scale-[1] opacity-100' : 'opacity-0 transition-none delay-0'}`
428
+ }
429
+ />
430
+ <span
431
+ className={
432
+ 'relative h-[21px] w-[21px] transition-[filter,transform] delay-[150ms] duration-300 ' +
433
+ `${activeNum === 1 ? 'translate-y-[-8px] brightness-[300]' : 'brightness-[0] transition-none delay-0'}`
434
+ }
435
+ >
436
+ <Image
437
+ src={KakaoIconM}
438
+ alt={''}
439
+ fill
440
+ className={'h-full w-full scale-110 object-contain'}
441
+ />
442
+ </span>
443
+ <p
444
+ className={
445
+ 'z-10 tracking-[-0.6px] transition-[color,font-weight] delay-[150ms] duration-300 ' +
446
+ `${activeNum === 1 ? 'font-[800] text-[#AE0E36]' : ' transition-none delay-0'}`
447
+ }
448
+ >
449
+ 카톡예약
450
+ </p>
451
+ </Link>
452
+ {/*전화 예약 버튼*/}
453
+ <button
454
+ className={'flex w-full flex-col items-center justify-center gap-[8px]'}
455
+ onClick={() => {
456
+ setViewCall(true);
457
+ }}
458
+ tabIndex={0}
459
+ aria-label="전화 예약"
460
+ id={'callBtn'}
461
+ onMouseEnter={() => {
462
+ setActiveNum(2);
463
+ setIsHovered(true);
464
+ }}
465
+ onMouseLeave={() => setIsHovered(false)}
466
+ >
467
+ <div
468
+ className={
469
+ 'absolute top-[-5px] z-0 aspect-square w-[40px] scale-50 rounded-full bg-[#AE0E36] delay-[150ms] duration-300 ' +
470
+ 'transition-[opacity,transform] ' +
471
+ `${activeNum === 2 ? 'scale-[1] opacity-100' : 'opacity-0 transition-none delay-0'}`
472
+ }
473
+ />
474
+ <span
475
+ className={
476
+ 'relative h-[21px] w-[21px] transition-[filter,transform] delay-[150ms] duration-300 ' +
477
+ `${activeNum === 2 ? 'translate-y-[-8px] brightness-[300]' : 'brightness-[0] transition-none delay-0'}`
478
+ }
479
+ >
480
+ <Image src={CallIconM} alt={''} fill className={'h-full w-full object-contain'} />
481
+ </span>
482
+ <p
483
+ className={
484
+ 'z-10 tracking-[-0.6px] transition-[color,font-weight] delay-[150ms] duration-300 ' +
485
+ `${activeNum === 2 ? 'font-[800] text-[#AE0E36]' : ' transition-none delay-0'}`
486
+ }
487
+ >
488
+ 전화예약
489
+ </p>
490
+ </button>
224
491
  </div>
225
- </div>
492
+ )}
226
493
  </div>
227
494
 
228
495
  {/*온라인*/}
229
- <div
230
- ref={onlineRef}
231
- className={
232
- 'pointer-events-none fixed bottom-[13px] right-[25px] h-[300px] w-[300px] bg-white px-[30px] py-[26px] opacity-0 shadow-[0_4px_8px_0_rgba(0,0,0,0.1)] ' +
233
- 'max-5xl:bottom-[10px] max-5xl:h-[230px] max-5xl:w-[230px] max-5xl:px-[22px] max-5xl:py-[20px] ' +
234
- ' max-lg:bottom-[85px] max-lg:left-[20px] max-lg:h-[160px] max-lg:w-[240px] max-lg:px-[20px] max-lg:py-[17px]'
235
- }
236
- >
237
- <span
238
- className={
239
- 'z-10 mb-[11px] flex w-full items-center justify-between text-[26px] font-bold leading-[30px] tracking-[-1.3px] max-5xl:text-[20px] max-lg:text-[18px] max-lg:leading-[23px]'
240
- }
241
- >
242
- 온라인 예약상담
243
- <Image
244
- src={MenuXIcon}
245
- width={54}
246
- height={54}
247
- alt={'취소'}
248
- onClick={() => {
249
- onlineRef.current?.classList.remove(style.fadeIn);
250
- onlineRef.current?.classList.add(style.fadeOut);
251
- }}
252
- className={'h-auto w-[20px] cursor-pointer max-5xl:w-[15px] max-lg:w-[15px]'}
253
- />
254
- </span>
255
-
256
- <span className={'text-[16px] tracking-[-0.8px] text-[#5C5C5C] max-5xl:text-[14px] max-lg:hidden'}>
257
- 해당사건에 특화된 전문변호사가 검토 후 신속한 대응전략을 제시합니다.
258
- </span>
259
-
260
- <button
261
- className={
262
- 'mb-[4px] mt-[32px] flex h-[60px] w-[240px] items-center justify-between rounded-[5px] bg-[#285EA7] px-[20px] py-[16px] text-[22px] font-bold text-white ' +
263
- ' max-5xl:mt-[13px] max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
264
- ' max-lg:mt-[17px] max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
265
- }
266
- onClick={async () => {
267
- await router.push('/consulting');
268
- }}
269
- >
270
- 기업상담
271
- <Image
272
- src={ArrowIcon}
273
- width={22}
274
- height={18}
275
- alt={'온라인 예약상담 기업상담'}
276
- className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
277
- />
278
- </button>
279
- <button
280
- className={
281
- 'flex h-[60px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
282
- ' max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
283
- ' max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
284
- }
285
- onClick={async () => {
286
- await router.push('/consult');
287
- }}
288
- >
289
- 개인상담
290
- <Image
291
- src={ArrowIcon}
292
- width={22}
293
- height={18}
294
- alt={'온라인 예약상담 개인상담'}
295
- className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
296
- />
297
- </button>
298
- </div>
496
+ {viewOnline ? (
497
+ <OnlineBox
498
+ titleTxt={'온라인 예약상담'}
499
+ reservationTxt={'해당사건에 특화된 전문변호사가 검토 후 신속한 대응전략을 제시합니다.'}
500
+ companyTxt={'기업상담'}
501
+ privateTxt={'개인상담'}
502
+ cancel={handleCancel}
503
+ onlineRef={onlineRef}
504
+ onConsultCompClick={() => onConsultCompClick()}
505
+ onConsultPersonalClick={() => onConsultPersonalClick()}
506
+ />
507
+ ) : (
508
+ <></>
509
+ )}
299
510
 
300
511
  {/*전화*/}
301
- <div
302
- ref={callRef}
303
- className={
304
- 'pointer-events-none fixed bottom-[13px] right-[25px] h-[300px] w-[300px] bg-white px-[30px] py-[26px] opacity-0 shadow-[0_4px_8px_0_rgba(0,0,0,0.1)] ' +
305
- 'max-5xl:bottom-[10px] max-5xl:h-[230px] max-5xl:w-[230px] max-5xl:px-[22px] max-5xl:py-[20px] ' +
306
- 'max-lg:bottom-[85px] max-lg:right-[20px] max-lg:h-[200px] max-lg:w-[240px] max-lg:px-[20px] max-lg:py-[17px]'
307
- }
308
- >
309
- <span
310
- className={
311
- 'z-10 mb-[11px] flex w-full items-center justify-between text-[26px] font-bold leading-[30px] tracking-[-1.3px] max-5xl:text-[20px] max-lg:text-[18px] max-lg:leading-[23px]'
312
- }
313
- >
314
- 전화 예약상담
315
- <Image
316
- src={MenuXIcon}
317
- width={54}
318
- height={54}
319
- alt={'취소'}
320
- onClick={() => {
321
- callRef.current?.classList.remove(style.fadeIn);
322
- callRef.current?.classList.add(style.fadeOut);
323
- }}
324
- className={'h-auto w-[20px] cursor-pointer max-5xl:w-[15px] max-lg:w-[15px]'}
325
- />
326
- </span>
327
-
328
- <Link
329
- href={`tel:${props.tel}`}
330
- className={
331
- 'mb-[4px] mt-[32px] flex h-[80px] w-[240px] items-center justify-between rounded-[5px] bg-[#285EA7] px-[20px] py-[16px] text-[22px] font-bold text-white' +
332
- ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
333
- ' max-lg:mt-[15px] max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
334
- }
335
- onClick={onClickTel}
336
- >
337
- <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
338
- <span className={'text-[20px] max-lg:text-[16px]'}>기업상담</span>
339
- {/* <span className={'text-[22px] max-lg:text-[16px] block'}>{tel}</span> */}
340
- </span>
341
- <Image
342
- src={Call2Icon}
343
- width={30}
344
- height={30}
345
- alt={'전화 예약상담 기업상담'}
346
- className={'h-[30px] w-[30px]'}
347
- />
348
- </Link>
349
- <Link
350
- href={`tel:${props.tel}`}
351
- className={
352
- 'flex h-[80px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
353
- ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
354
- ' max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
355
- }
356
- onClick={onClickTel}
357
- >
358
- <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
359
- <span className={'text-[20px] max-lg:text-[16px] '}>개인상담</span>
360
- {/* <span className={'text-[22px] max-lg:text-[16px] block '}>{tel}</span> */}
361
- </span>
362
- <Image
363
- src={Call2Icon}
364
- width={30}
365
- height={30}
366
- alt={'전화 예약상담 개인상담'}
367
- className={'h-[30px] w-[30px]'}
368
- />
369
- </Link>
370
- </div>
512
+ {viewCall ? (
513
+ <CallBox
514
+ titleTxt={'전화 예약상담'}
515
+ tel={props.tel}
516
+ companyTxt={'기업상담'}
517
+ privateTxt={'개인상담'}
518
+ cancel={handleCancel}
519
+ onClickTel={onClickTel}
520
+ callRef={callRef}
521
+ />
522
+ ) : (
523
+ <></>
524
+ )}
371
525
  </div>
372
526
  </>
373
527
  );
374
528
  };
375
529
 
376
530
  export default Fix;
531
+
532
+ const OnlineBox = (props: {
533
+ titleTxt: string;
534
+ reservationTxt: string;
535
+ companyTxt: string;
536
+ privateTxt: string;
537
+ cancel: (ref: RefObject<HTMLDivElement>, type: 'online' | 'call') => void;
538
+ onlineRef: RefObject<HTMLDivElement>;
539
+ onConsultCompClick: () => void;
540
+ onConsultPersonalClick: () => void;
541
+ }) => {
542
+ const closeRef = useRef<HTMLButtonElement>(null);
543
+ return (
544
+ <div
545
+ ref={props.onlineRef}
546
+ className={
547
+ 'fixed bottom-[33px] right-[25px] z-50 h-[300px] w-[300px] bg-white px-[30px] py-[26px] shadow-[0_4px_8px_0_rgba(0,0,0,0.1)] ' +
548
+ 'max-5xl:bottom-[10px] max-5xl:h-[230px] max-5xl:w-[230px] max-5xl:px-[22px] max-5xl:py-[20px] ' +
549
+ 'max-lg:bottom-[85px] max-lg:left-[20px] max-lg:h-[160px] max-lg:w-[240px] max-lg:px-[20px] max-lg:py-[17px] ' +
550
+ 'animate-[fadeIn_0.15s] transition-opacity '
551
+ }
552
+ >
553
+ <span
554
+ className={
555
+ 'z-10 mb-[11px] flex w-full items-center justify-between text-[26px] font-bold leading-[30px] tracking-[-1.3px] max-5xl:text-[20px] max-lg:text-[18px] max-lg:leading-[23px]'
556
+ }
557
+ >
558
+ {props.titleTxt}
559
+ <button onClick={() => props.cancel(props.onlineRef, 'online')} ref={closeRef}>
560
+ <Image
561
+ src={MenuXIcon}
562
+ width={54}
563
+ height={54}
564
+ alt={'온라인상담 닫기'}
565
+ className={'h-auto w-[20px] cursor-pointer max-5xl:w-[15px] max-lg:w-[15px]'}
566
+ />
567
+ </button>
568
+ </span>
569
+ <span className={'text-[16px] tracking-[-0.8px] text-[#5C5C5C] max-5xl:text-[14px] max-lg:hidden'}>
570
+ {props.reservationTxt}
571
+ </span>
572
+ <Link
573
+ className={
574
+ 'mb-[4px] mt-[32px] flex h-[60px] w-[240px] items-center justify-between rounded-[5px] bg-[#285EA7] px-[20px] py-[16px] text-[22px] font-bold text-white ' +
575
+ ' max-5xl:mt-[13px] max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
576
+ ' max-lg:mt-[17px] max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
577
+ }
578
+ href={'/consulting'}
579
+ aria-label={'기업 온라인 상담'}
580
+ onClick={props.onConsultCompClick}
581
+ >
582
+ {props.companyTxt}
583
+ <Image
584
+ src={ArrowIcon}
585
+ width={22}
586
+ height={18}
587
+ alt={''}
588
+ className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
589
+ />
590
+ </Link>
591
+ <Link
592
+ className={
593
+ 'flex h-[60px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
594
+ ' max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
595
+ ' max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
596
+ }
597
+ href={'/consult'}
598
+ aria-label={'개인 온라인 상담'}
599
+ onClick={props.onConsultPersonalClick}
600
+ onKeyDown={e => {
601
+ if (e.key === 'Tab') {
602
+ e.preventDefault();
603
+ closeRef.current?.focus();
604
+ }
605
+ }}
606
+ >
607
+ {props.privateTxt}
608
+ <Image
609
+ src={ArrowIcon}
610
+ width={22}
611
+ height={18}
612
+ alt={''}
613
+ className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
614
+ />
615
+ </Link>
616
+ </div>
617
+ );
618
+ };
619
+
620
+ const CallBox = (props: {
621
+ titleTxt: string;
622
+ tel: string;
623
+ companyTxt: string;
624
+ privateTxt: string;
625
+ cancel: (ref: RefObject<HTMLDivElement>, type: 'online' | 'call') => void;
626
+ onClickTel: () => void;
627
+ callRef: RefObject<HTMLDivElement>;
628
+ }) => {
629
+ const closeRef = useRef<HTMLButtonElement>(null);
630
+
631
+ return (
632
+ <div
633
+ ref={props.callRef}
634
+ className={
635
+ 'fixed bottom-[13px] right-[25px] z-50 h-[300px] w-[300px] bg-white px-[30px] py-[26px] shadow-[0_4px_8px_0_rgba(0,0,0,0.1)] ' +
636
+ 'max-5xl:bottom-[10px] max-5xl:h-[230px] max-5xl:w-[230px] max-5xl:px-[22px] max-5xl:py-[20px] ' +
637
+ 'max-lg:bottom-[85px] max-lg:right-[20px] max-lg:h-[200px] max-lg:w-[240px] max-lg:px-[20px] max-lg:py-[17px] ' +
638
+ 'animate-[fadeIn_0.15s] transition-opacity '
639
+ }
640
+ >
641
+ <span
642
+ className={
643
+ 'z-10 mb-[11px] flex w-full items-center justify-between text-[26px] font-bold leading-[30px] tracking-[-1.3px] max-5xl:text-[20px] max-lg:text-[18px] max-lg:leading-[23px]'
644
+ }
645
+ >
646
+ {props.titleTxt}
647
+ <button onClick={() => props.cancel(props.callRef, 'call')} ref={closeRef}>
648
+ <Image
649
+ src={MenuXIcon}
650
+ width={54}
651
+ height={54}
652
+ alt={'취소'}
653
+ className={'h-auto w-[20px] cursor-pointer max-5xl:w-[15px] max-lg:w-[15px]'}
654
+ />
655
+ </button>
656
+ </span>
657
+
658
+ <Link
659
+ href={`tel:${props.tel}`}
660
+ className={
661
+ 'mb-[4px] mt-[32px] flex h-[80px] w-[240px] items-center justify-between rounded-[5px] bg-[#285EA7] px-[20px] py-[16px] text-[22px] font-bold text-white' +
662
+ ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
663
+ ' max-lg:mt-[15px] max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
664
+ }
665
+ onClick={props.onClickTel}
666
+ aria-label={'기업 전화상담'}
667
+ >
668
+ <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
669
+ <span className={'text-[20px] max-lg:text-[16px]'}>{props.companyTxt}</span>
670
+ {/* <span className={'text-[22px] max-lg:text-[16px] block'}>{tel}</span> */}
671
+ </span>
672
+ <Image src={Call2Icon} width={30} height={30} alt={''} className={'h-[30px] w-[30px]'} />
673
+ </Link>
674
+ <Link
675
+ href={`tel:${props.tel}`}
676
+ className={
677
+ 'flex h-[80px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
678
+ ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
679
+ ' max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
680
+ }
681
+ onClick={props.onClickTel}
682
+ aria-label={'개인 전화상담'}
683
+ onKeyDown={e => {
684
+ if (e.key === 'Tab') {
685
+ e.preventDefault();
686
+ closeRef.current?.focus();
687
+ }
688
+ }}
689
+ >
690
+ <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
691
+ <span className={'text-[20px] max-lg:text-[16px] '}>{props.privateTxt}</span>
692
+ {/* <span className={'text-[22px] max-lg:text-[16px] block '}>{tel}</span> */}
693
+ </span>
694
+ <Image src={Call2Icon} width={30} height={30} alt={''} className={'h-[30px] w-[30px]'} />
695
+ </Link>
696
+ </div>
697
+ );
698
+ };