@daeryun/dr_components 0.1.85 → 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.
@@ -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,28 @@ 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
+
207
256
  return (
208
257
  <>
209
258
  <div
@@ -211,16 +260,26 @@ const Fix = (props: { tel: string; aceUrl?: string }) => {
211
260
  // (isTop ? ' hidden ' : '') +
212
261
  ' fixed bottom-[6.5%] right-[25px] z-[2000] w-fit font-[SUIT] ' +
213
262
  ' max-5xl:bottom-[4%] ' +
214
- ' 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)] '
215
264
  }
216
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
+
217
276
  {/*Fix*/}
218
277
 
219
278
  <div
220
279
  className={
221
280
  'relative z-20 h-[330px] w-[100px] overflow-hidden rounded-full shadow-[0_4px_8px_0_rgba(0,0,0,0.1)] ' +
222
281
  '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)] '
282
+ 'max-lg:h-[70px] max-lg:w-full max-lg:overflow-visible max-lg:shadow-none '
224
283
  }
225
284
  >
226
285
  <div
@@ -230,221 +289,410 @@ const Fix = (props: { tel: string; aceUrl?: string }) => {
230
289
  >
231
290
  Quick Menu
232
291
  </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
- {/*온라인 예약 버튼*/}
292
+ {width >= 1024 ? (
241
293
  <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
- }}
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
+ }
250
300
  >
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
- 온라인예약
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>
259
356
  </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
- {/*전화 예약 버튼*/}
357
+ ) : (
279
358
  <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
- }}
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
+ }
287
362
  >
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
- 전화예약
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>
296
491
  </div>
297
- </div>
492
+ )}
298
493
  </div>
299
494
 
300
495
  {/*온라인*/}
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>
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
+ )}
373
510
 
374
511
  {/*전화*/}
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>
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
+ )}
445
525
  </div>
446
526
  </>
447
527
  );
448
528
  };
449
529
 
450
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
+ };