@daeryun/dr_components 0.1.85 → 0.1.87

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,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,16 +13,43 @@ 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
20
  const Fix = (props: { tel: string; aceUrl?: string }) => {
18
21
  const mobile = require('is-mobile');
19
22
  const [isMobile, setIsMobile] = useState<boolean>(false);
20
23
  // const [isTop, setIsTop] = useState(true);
24
+ //온라인상담, 전화상담
25
+ const [viewOnline, setViewOnline] = useState<boolean>(false);
26
+ const [viewCall, setViewCall] = useState<boolean>(false);
21
27
  const onlineRef = useRef<HTMLDivElement>(null);
22
28
  const callRef = useRef<HTMLDivElement>(null);
29
+ const { width } = useBrowser();
30
+
31
+ //모바일 액티브
32
+ const [activeNum, setActiveNum] = useState(0);
33
+ const [isHovered, setIsHovered] = useState(false);
23
34
 
24
35
  const router = useRouter();
25
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
+
26
53
  const onClickConsult = () => {
27
54
  if (isMobile) {
28
55
  mConsultClick();
@@ -204,6 +231,33 @@ const Fix = (props: { tel: string; aceUrl?: string }) => {
204
231
  setIsMobile(is_mobile);
205
232
  }, []);
206
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
+
256
+ useEffect(() => {
257
+ setViewOnline(false);
258
+ setViewCall(false);
259
+ }, [router.pathname]);
260
+
207
261
  return (
208
262
  <>
209
263
  <div
@@ -211,16 +265,26 @@ const Fix = (props: { tel: string; aceUrl?: string }) => {
211
265
  // (isTop ? ' hidden ' : '') +
212
266
  ' fixed bottom-[6.5%] right-[25px] z-[2000] w-fit font-[SUIT] ' +
213
267
  ' max-5xl:bottom-[4%] ' +
214
- ' max-lg:relative max-lg:bottom-0 max-lg:right-0 max-lg:w-full'
268
+ ' 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)] '
215
269
  }
216
270
  >
271
+ {/*모바일용 원*/}
272
+ <div
273
+ className={
274
+ 'absolute -top-[10px] aspect-square w-[50px] translate-x-[-50%] rounded-full bg-white transition-[left] duration-300 ease-out lg:hidden '
275
+ }
276
+ style={{
277
+ left: `calc(((100%/3)/2)*${activeNum * 2 + 1})`
278
+ }}
279
+ />
280
+
217
281
  {/*Fix*/}
218
282
 
219
283
  <div
220
284
  className={
221
285
  'relative z-20 h-[330px] w-[100px] overflow-hidden rounded-full shadow-[0_4px_8px_0_rgba(0,0,0,0.1)] ' +
222
286
  'max-5xl:h-[250px] max-5xl:w-[75px] ' +
223
- '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)] '
287
+ 'max-lg:h-[70px] max-lg:w-full max-lg:overflow-visible max-lg:shadow-none '
224
288
  }
225
289
  >
226
290
  <div
@@ -230,221 +294,410 @@ const Fix = (props: { tel: string; aceUrl?: string }) => {
230
294
  >
231
295
  Quick Menu
232
296
  </div>
233
- <div
234
- className={
235
- '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] ' +
236
- ' max-5xl:gap-y-[13px] max-5xl:py-[13px] max-5xl:text-[13px] ' +
237
- ' max-lg:flex-row max-lg:pb-[18px] max-lg:pt-[20px] max-lg:text-[13px] '
238
- }
239
- >
240
- {/*온라인 예약 버튼*/}
297
+ {width >= 1024 ? (
241
298
  <div
242
- className={'flex w-full cursor-pointer flex-col items-center'}
243
- onClick={() => {
244
- onClickConsult();
245
- callRef.current?.classList.remove(style.fadeIn);
246
- callRef.current?.classList.remove(style.fadeOut);
247
- onlineRef.current?.classList.remove(style.fadeOut);
248
- onlineRef.current?.classList.add(style.fadeIn);
249
- }}
299
+ className={
300
+ '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] ' +
301
+ ' max-5xl:gap-y-[13px] max-5xl:py-[13px] max-5xl:text-[13px] ' +
302
+ ' max-lg:flex-row max-lg:pb-[18px] max-lg:pt-[20px] max-lg:text-[13px] ' +
303
+ ' max-lg:hidden'
304
+ }
250
305
  >
251
- <Image
252
- src={OnlineIcon}
253
- alt={'online icon'}
254
- width={33}
255
- height={38}
256
- className={'h-auto w-[33px] max-5xl:w-[23px] max-lg:w-[25px] lg:mb-[3px] 5xl:mb-[5px] '}
257
- />
258
- 온라인예약
306
+ {/*온라인 예약 버튼*/}
307
+ <div
308
+ className={'flex w-full cursor-pointer flex-col items-center'}
309
+ onClick={() => {
310
+ onClickConsult();
311
+ setViewOnline(true);
312
+ }}
313
+ >
314
+ <Image
315
+ src={OnlineIcon}
316
+ alt={'online icon'}
317
+ width={33}
318
+ height={38}
319
+ className={
320
+ 'h-auto w-[33px] max-5xl:w-[23px] max-lg:w-[25px] lg:mb-[3px] 5xl:mb-[5px] '
321
+ }
322
+ />
323
+ 온라인예약
324
+ </div>
325
+ {/*카톡 예약 버튼*/}
326
+ <Link
327
+ href="https://pf.kakao.com/_xgxoTlK/chat"
328
+ target={'_blank'}
329
+ className={'flex w-full cursor-pointer flex-col items-center'}
330
+ onClick={onClickKakao}
331
+ >
332
+ <Image
333
+ src={KakaoIcon}
334
+ alt={'kakao icon'}
335
+ width={33}
336
+ height={31}
337
+ className={
338
+ 'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px] '
339
+ }
340
+ />
341
+ 카톡예약
342
+ </Link>
343
+ {/*전화 예약 버튼*/}
344
+ <div
345
+ className={'flex w-full cursor-pointer flex-col items-center'}
346
+ onClick={() => {
347
+ setViewCall(true);
348
+ }}
349
+ >
350
+ <Image
351
+ src={CallIcon}
352
+ alt={'call icon'}
353
+ width={33}
354
+ height={33}
355
+ className={
356
+ 'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px]'
357
+ }
358
+ />
359
+ 전화예약
360
+ </div>
259
361
  </div>
260
- {/*카톡 예약 버튼*/}
261
- <Link
262
- href="https://pf.kakao.com/_xgxoTlK/chat"
263
- target={'_blank'}
264
- className={'flex w-full cursor-pointer flex-col items-center'}
265
- onClick={onClickKakao}
266
- >
267
- <Image
268
- src={KakaoIcon}
269
- alt={'kakao icon'}
270
- width={33}
271
- height={31}
272
- className={
273
- 'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px] '
274
- }
275
- />
276
- 카톡예약
277
- </Link>
278
- {/*전화 예약 버튼*/}
362
+ ) : (
279
363
  <div
280
- className={'flex w-full cursor-pointer flex-col items-center'}
281
- onClick={() => {
282
- onlineRef.current?.classList.remove(style.fadeIn);
283
- onlineRef.current?.classList.remove(style.fadeOut);
284
- callRef.current?.classList.remove(style.fadeOut);
285
- callRef.current?.classList.add(style.fadeIn);
286
- }}
364
+ className={
365
+ 'flex h-full w-full rounded-t-[20px] bg-white pb-[5px] text-[13px] font-[600] leading-none text-[#2B2B2B] lg:hidden '
366
+ }
287
367
  >
288
- <Image
289
- src={CallIcon}
290
- alt={'call icon'}
291
- width={33}
292
- height={33}
293
- className={'mb-[5px] h-auto w-[33px] max-5xl:mb-[3px] max-5xl:w-[23px] max-lg:w-[25px]'}
294
- />
295
- 전화예약
368
+ {/*온라인 예약 버튼*/}
369
+ <button
370
+ className={'relative z-10 flex w-full flex-col items-center justify-center gap-[8px]'}
371
+ onClick={() => {
372
+ onClickConsult();
373
+ setViewOnline(true);
374
+ }}
375
+ tabIndex={0}
376
+ aria-label="온라인 예약"
377
+ id={'onlineBtn'}
378
+ onMouseEnter={() => {
379
+ setActiveNum(0);
380
+ setIsHovered(true);
381
+ }}
382
+ onMouseLeave={() => setIsHovered(false)}
383
+ >
384
+ <div
385
+ className={
386
+ 'absolute top-[-5px] z-0 aspect-square w-[40px] scale-50 rounded-full bg-[#AE0E36] delay-[150ms] duration-300 ' +
387
+ 'transition-[opacity,transform] ' +
388
+ `${activeNum === 0 ? 'scale-[1] opacity-100' : 'opacity-0 transition-none delay-0'}`
389
+ }
390
+ />
391
+ <span
392
+ className={
393
+ 'relative h-[21px] w-[21px] transition-[filter,transform] delay-[150ms] duration-300 ' +
394
+ `${activeNum === 0 ? 'translate-y-[-8px] brightness-[300]' : 'brightness-[0] transition-none delay-0'}`
395
+ }
396
+ >
397
+ <Image
398
+ src={OnlineIconM}
399
+ alt={''}
400
+ fill
401
+ className={'h-full w-full object-contain '}
402
+ />
403
+ </span>
404
+ <p
405
+ className={
406
+ 'z-10 tracking-[-0.6px] transition-[color,font-weight] delay-[150ms] duration-300 ' +
407
+ `${activeNum === 0 ? 'font-[800] text-[#AE0E36]' : ' transition-none delay-0'}`
408
+ }
409
+ >
410
+ 온라인예약
411
+ </p>
412
+ </button>
413
+ {/*카톡 예약 버튼*/}
414
+ <Link
415
+ href="https://pf.kakao.com/_xgxoTlK/chat"
416
+ title={'새창열림'}
417
+ target={'_blank'}
418
+ className={'flex w-full flex-col items-center justify-center gap-[8px]'}
419
+ onClick={onClickKakao}
420
+ tabIndex={0}
421
+ aria-label="카카오톡 예약"
422
+ onMouseEnter={() => {
423
+ setActiveNum(1);
424
+ setIsHovered(true);
425
+ }}
426
+ onMouseLeave={() => setIsHovered(false)}
427
+ >
428
+ <div
429
+ className={
430
+ 'absolute top-[-5px] z-0 aspect-square w-[40px] scale-50 rounded-full bg-[#AE0E36] delay-[150ms] duration-300 ' +
431
+ 'transition-[opacity,transform] ' +
432
+ `${activeNum === 1 ? 'scale-[1] opacity-100' : 'opacity-0 transition-none delay-0'}`
433
+ }
434
+ />
435
+ <span
436
+ className={
437
+ 'relative h-[21px] w-[21px] transition-[filter,transform] delay-[150ms] duration-300 ' +
438
+ `${activeNum === 1 ? 'translate-y-[-8px] brightness-[300]' : 'brightness-[0] transition-none delay-0'}`
439
+ }
440
+ >
441
+ <Image
442
+ src={KakaoIconM}
443
+ alt={''}
444
+ fill
445
+ className={'h-full w-full scale-110 object-contain'}
446
+ />
447
+ </span>
448
+ <p
449
+ className={
450
+ 'z-10 tracking-[-0.6px] transition-[color,font-weight] delay-[150ms] duration-300 ' +
451
+ `${activeNum === 1 ? 'font-[800] text-[#AE0E36]' : ' transition-none delay-0'}`
452
+ }
453
+ >
454
+ 카톡예약
455
+ </p>
456
+ </Link>
457
+ {/*전화 예약 버튼*/}
458
+ <button
459
+ className={'flex w-full flex-col items-center justify-center gap-[8px]'}
460
+ onClick={() => {
461
+ setViewCall(true);
462
+ }}
463
+ tabIndex={0}
464
+ aria-label="전화 예약"
465
+ id={'callBtn'}
466
+ onMouseEnter={() => {
467
+ setActiveNum(2);
468
+ setIsHovered(true);
469
+ }}
470
+ onMouseLeave={() => setIsHovered(false)}
471
+ >
472
+ <div
473
+ className={
474
+ 'absolute top-[-5px] z-0 aspect-square w-[40px] scale-50 rounded-full bg-[#AE0E36] delay-[150ms] duration-300 ' +
475
+ 'transition-[opacity,transform] ' +
476
+ `${activeNum === 2 ? 'scale-[1] opacity-100' : 'opacity-0 transition-none delay-0'}`
477
+ }
478
+ />
479
+ <span
480
+ className={
481
+ 'relative h-[21px] w-[21px] transition-[filter,transform] delay-[150ms] duration-300 ' +
482
+ `${activeNum === 2 ? 'translate-y-[-8px] brightness-[300]' : 'brightness-[0] transition-none delay-0'}`
483
+ }
484
+ >
485
+ <Image src={CallIconM} alt={''} fill className={'h-full w-full object-contain'} />
486
+ </span>
487
+ <p
488
+ className={
489
+ 'z-10 tracking-[-0.6px] transition-[color,font-weight] delay-[150ms] duration-300 ' +
490
+ `${activeNum === 2 ? 'font-[800] text-[#AE0E36]' : ' transition-none delay-0'}`
491
+ }
492
+ >
493
+ 전화예약
494
+ </p>
495
+ </button>
296
496
  </div>
297
- </div>
497
+ )}
298
498
  </div>
299
499
 
300
500
  {/*온라인*/}
301
- <div
302
- ref={onlineRef}
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:left-[20px] max-lg:h-[160px] 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
- onlineRef.current?.classList.remove(style.fadeIn);
322
- onlineRef.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
- <span className={'text-[16px] tracking-[-0.8px] text-[#5C5C5C] max-5xl:text-[14px] max-lg:hidden'}>
329
- 해당사건에 특화된 전문변호사가 검토 후 신속한 대응전략을 제시합니다.
330
- </span>
331
-
332
- <button
333
- className={
334
- '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 ' +
335
- ' max-5xl:mt-[13px] max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
336
- ' max-lg:mt-[17px] max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
337
- }
338
- onClick={async () => {
339
- onConsultCompClick();
340
- await router.push('/consulting');
341
- }}
342
- >
343
- 기업상담
344
- <Image
345
- src={ArrowIcon}
346
- width={22}
347
- height={18}
348
- alt={'온라인 예약상담 기업상담'}
349
- className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
350
- />
351
- </button>
352
- <button
353
- className={
354
- 'flex h-[60px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
355
- ' max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
356
- ' max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
357
- }
358
- onClick={async () => {
359
- onConsultPersonalClick();
360
- await router.push('/consult');
361
- }}
362
- >
363
- 개인상담
364
- <Image
365
- src={ArrowIcon}
366
- width={22}
367
- height={18}
368
- alt={'온라인 예약상담 개인상담'}
369
- className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
370
- />
371
- </button>
372
- </div>
501
+ {viewOnline ? (
502
+ <OnlineBox
503
+ titleTxt={'온라인 예약상담'}
504
+ reservationTxt={'해당사건에 특화된 전문변호사가 검토 후 신속한 대응전략을 제시합니다.'}
505
+ companyTxt={'기업상담'}
506
+ privateTxt={'개인상담'}
507
+ cancel={handleCancel}
508
+ onlineRef={onlineRef}
509
+ onConsultCompClick={() => onConsultCompClick()}
510
+ onConsultPersonalClick={() => onConsultPersonalClick()}
511
+ />
512
+ ) : (
513
+ <></>
514
+ )}
373
515
 
374
516
  {/*전화*/}
375
- <div
376
- ref={callRef}
377
- className={
378
- '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)] ' +
379
- 'max-5xl:bottom-[10px] max-5xl:h-[230px] max-5xl:w-[230px] max-5xl:px-[22px] max-5xl:py-[20px] ' +
380
- 'max-lg:bottom-[85px] max-lg:right-[20px] max-lg:h-[200px] max-lg:w-[240px] max-lg:px-[20px] max-lg:py-[17px]'
381
- }
382
- >
383
- <span
384
- className={
385
- '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]'
386
- }
387
- >
388
- 전화 예약상담
389
- <Image
390
- src={MenuXIcon}
391
- width={54}
392
- height={54}
393
- alt={'취소'}
394
- onClick={() => {
395
- callRef.current?.classList.remove(style.fadeIn);
396
- callRef.current?.classList.add(style.fadeOut);
397
- }}
398
- className={'h-auto w-[20px] cursor-pointer max-5xl:w-[15px] max-lg:w-[15px]'}
399
- />
400
- </span>
401
-
402
- <Link
403
- href={`tel:${props.tel}`}
404
- className={
405
- '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' +
406
- ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
407
- ' max-lg:mt-[15px] max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
408
- }
409
- onClick={onClickTel}
410
- >
411
- <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
412
- <span className={'text-[20px] max-lg:text-[16px]'}>기업상담</span>
413
- {/* <span className={'text-[22px] max-lg:text-[16px] block'}>{tel}</span> */}
414
- </span>
415
- <Image
416
- src={Call2Icon}
417
- width={30}
418
- height={30}
419
- alt={'전화 예약상담 기업상담'}
420
- className={'h-[30px] w-[30px]'}
421
- />
422
- </Link>
423
- <Link
424
- href={`tel:${props.tel}`}
425
- className={
426
- 'flex h-[80px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
427
- ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
428
- ' max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
429
- }
430
- onClick={onClickTel}
431
- >
432
- <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
433
- <span className={'text-[20px] max-lg:text-[16px] '}>개인상담</span>
434
- {/* <span className={'text-[22px] max-lg:text-[16px] block '}>{tel}</span> */}
435
- </span>
436
- <Image
437
- src={Call2Icon}
438
- width={30}
439
- height={30}
440
- alt={'전화 예약상담 개인상담'}
441
- className={'h-[30px] w-[30px]'}
442
- />
443
- </Link>
444
- </div>
517
+ {viewCall ? (
518
+ <CallBox
519
+ titleTxt={'전화 예약상담'}
520
+ tel={props.tel}
521
+ companyTxt={'기업상담'}
522
+ privateTxt={'개인상담'}
523
+ cancel={handleCancel}
524
+ onClickTel={onClickTel}
525
+ callRef={callRef}
526
+ />
527
+ ) : (
528
+ <></>
529
+ )}
445
530
  </div>
446
531
  </>
447
532
  );
448
533
  };
449
534
 
450
535
  export default Fix;
536
+
537
+ const OnlineBox = (props: {
538
+ titleTxt: string;
539
+ reservationTxt: string;
540
+ companyTxt: string;
541
+ privateTxt: string;
542
+ cancel: (ref: RefObject<HTMLDivElement>, type: 'online' | 'call') => void;
543
+ onlineRef: RefObject<HTMLDivElement>;
544
+ onConsultCompClick: () => void;
545
+ onConsultPersonalClick: () => void;
546
+ }) => {
547
+ const closeRef = useRef<HTMLButtonElement>(null);
548
+ return (
549
+ <div
550
+ ref={props.onlineRef}
551
+ className={
552
+ '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)] ' +
553
+ 'max-5xl:bottom-[10px] max-5xl:h-[230px] max-5xl:w-[230px] max-5xl:px-[22px] max-5xl:py-[20px] ' +
554
+ 'max-lg:bottom-[85px] max-lg:left-[20px] max-lg:h-[160px] max-lg:w-[240px] max-lg:px-[20px] max-lg:py-[17px] ' +
555
+ 'animate-[fadeIn_0.15s] transition-opacity '
556
+ }
557
+ >
558
+ <span
559
+ className={
560
+ '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]'
561
+ }
562
+ >
563
+ {props.titleTxt}
564
+ <button onClick={() => props.cancel(props.onlineRef, 'online')} ref={closeRef}>
565
+ <Image
566
+ src={MenuXIcon}
567
+ width={54}
568
+ height={54}
569
+ alt={'온라인상담 닫기'}
570
+ className={'h-auto w-[20px] cursor-pointer max-5xl:w-[15px] max-lg:w-[15px]'}
571
+ />
572
+ </button>
573
+ </span>
574
+ <span className={'text-[16px] tracking-[-0.8px] text-[#5C5C5C] max-5xl:text-[14px] max-lg:hidden'}>
575
+ {props.reservationTxt}
576
+ </span>
577
+ <Link
578
+ className={
579
+ '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 ' +
580
+ ' max-5xl:mt-[13px] max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
581
+ ' max-lg:mt-[17px] max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
582
+ }
583
+ href={'/consulting'}
584
+ aria-label={'기업 온라인 상담'}
585
+ onClick={props.onConsultCompClick}
586
+ >
587
+ {props.companyTxt}
588
+ <Image
589
+ src={ArrowIcon}
590
+ width={22}
591
+ height={18}
592
+ alt={''}
593
+ className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
594
+ />
595
+ </Link>
596
+ <Link
597
+ className={
598
+ 'flex h-[60px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
599
+ ' max-5xl:h-[45px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
600
+ ' max-lg:h-[40px] max-lg:w-[200px] max-lg:py-[10px] max-lg:text-[16px] '
601
+ }
602
+ href={'/consult'}
603
+ aria-label={'개인 온라인 상담'}
604
+ onClick={props.onConsultPersonalClick}
605
+ onKeyDown={e => {
606
+ if (e.key === 'Tab') {
607
+ e.preventDefault();
608
+ closeRef.current?.focus();
609
+ }
610
+ }}
611
+ >
612
+ {props.privateTxt}
613
+ <Image
614
+ src={ArrowIcon}
615
+ width={22}
616
+ height={18}
617
+ alt={''}
618
+ className={'h-auto w-[22px] max-5xl:w-[20px] max-lg:w-[17px]'}
619
+ />
620
+ </Link>
621
+ </div>
622
+ );
623
+ };
624
+
625
+ const CallBox = (props: {
626
+ titleTxt: string;
627
+ tel: string;
628
+ companyTxt: string;
629
+ privateTxt: string;
630
+ cancel: (ref: RefObject<HTMLDivElement>, type: 'online' | 'call') => void;
631
+ onClickTel: () => void;
632
+ callRef: RefObject<HTMLDivElement>;
633
+ }) => {
634
+ const closeRef = useRef<HTMLButtonElement>(null);
635
+
636
+ return (
637
+ <div
638
+ ref={props.callRef}
639
+ className={
640
+ '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)] ' +
641
+ 'max-5xl:bottom-[10px] max-5xl:h-[230px] max-5xl:w-[230px] max-5xl:px-[22px] max-5xl:py-[20px] ' +
642
+ 'max-lg:bottom-[85px] max-lg:right-[20px] max-lg:h-[200px] max-lg:w-[240px] max-lg:px-[20px] max-lg:py-[17px] ' +
643
+ 'animate-[fadeIn_0.15s] transition-opacity '
644
+ }
645
+ >
646
+ <span
647
+ className={
648
+ '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]'
649
+ }
650
+ >
651
+ {props.titleTxt}
652
+ <button onClick={() => props.cancel(props.callRef, 'call')} ref={closeRef}>
653
+ <Image
654
+ src={MenuXIcon}
655
+ width={54}
656
+ height={54}
657
+ alt={'취소'}
658
+ className={'h-auto w-[20px] cursor-pointer max-5xl:w-[15px] max-lg:w-[15px]'}
659
+ />
660
+ </button>
661
+ </span>
662
+
663
+ <Link
664
+ href={`tel:${props.tel}`}
665
+ className={
666
+ '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' +
667
+ ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
668
+ ' max-lg:mt-[15px] max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
669
+ }
670
+ onClick={props.onClickTel}
671
+ aria-label={'기업 전화상담'}
672
+ >
673
+ <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
674
+ <span className={'text-[20px] max-lg:text-[16px]'}>{props.companyTxt}</span>
675
+ {/* <span className={'text-[22px] max-lg:text-[16px] block'}>{tel}</span> */}
676
+ </span>
677
+ <Image src={Call2Icon} width={30} height={30} alt={''} className={'h-[30px] w-[30px]'} />
678
+ </Link>
679
+ <Link
680
+ href={`tel:${props.tel}`}
681
+ className={
682
+ 'flex h-[80px] w-[240px] items-center justify-between rounded-[5px] bg-[#0A96AF] px-[20px] py-[16px] text-[22px] font-bold text-white' +
683
+ ' max-5xl:h-[60px] max-5xl:w-[190px] max-5xl:text-[18px] ' +
684
+ ' max-lg:h-[60px] max-lg:w-[200px] max-lg:px-[15px] max-lg:py-[12px] '
685
+ }
686
+ onClick={props.onClickTel}
687
+ aria-label={'개인 전화상담'}
688
+ onKeyDown={e => {
689
+ if (e.key === 'Tab') {
690
+ e.preventDefault();
691
+ closeRef.current?.focus();
692
+ }
693
+ }}
694
+ >
695
+ <span className={'text-left font-bold leading-tight max-lg:leading-[17.5px]'}>
696
+ <span className={'text-[20px] max-lg:text-[16px] '}>{props.privateTxt}</span>
697
+ {/* <span className={'text-[22px] max-lg:text-[16px] block '}>{tel}</span> */}
698
+ </span>
699
+ <Image src={Call2Icon} width={30} height={30} alt={''} className={'h-[30px] w-[30px]'} />
700
+ </Link>
701
+ </div>
702
+ );
703
+ };