@daeryun/dr_components 0.2.55 → 0.2.57

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.
@@ -5,7 +5,7 @@ import Image from 'next/image';
5
5
  import { insert } from '../../lib';
6
6
  import * as gtag from '../../lib/gtag';
7
7
  import { savePowerLinkConversion } from '../../lib';
8
- import { useRouter } from 'next/router';
8
+ import { usePathname, useRouter } from 'next/navigation';
9
9
  import useBrowser from '../common/hook/useBrowser';
10
10
  import OnlineIcon from '../../asset/images/fix/online.webp';
11
11
  import KakaoIcon from '../../asset/images/fix/kakao.webp';
@@ -18,6 +18,7 @@ import KakaoIconM from '../../asset/images/fix/kakao_m.webp';
18
18
  import CallIconM from '../../asset/images/fix/call_m.webp';
19
19
  const Fix = (props) => {
20
20
  const mobile = require('is-mobile');
21
+ const pathname = usePathname();
21
22
  const [isMobile, setIsMobile] = useState(false);
22
23
  // const [isTop, setIsTop] = useState(true);
23
24
  //온라인상담, 전화상담
@@ -243,7 +244,7 @@ const Fix = (props) => {
243
244
  useEffect(() => {
244
245
  setViewOnline(false);
245
246
  setViewCall(false);
246
- }, [router.pathname]);
247
+ }, [pathname]);
247
248
  return (<>
248
249
  <div className={
249
250
  // (isTop ? ' hidden ' : '') +
@@ -6,7 +6,7 @@ import Image from 'next/image';
6
6
  import { insert } from '../../lib';
7
7
  import * as gtag from '../../lib/gtag';
8
8
  import { savePowerLinkConversion } from '../../lib';
9
- import { useRouter } from 'next/router';
9
+ import { usePathname, useRouter } from 'next/navigation';
10
10
  import useBrowser from '../common/hook/useBrowser';
11
11
 
12
12
  import OnlineIcon from '../../asset/images/fix/online.webp';
@@ -21,6 +21,7 @@ import CallIconM from '../../asset/images/fix/call_m.webp';
21
21
 
22
22
  const Fix = (props: { tel: string; aceUrl?: string; wideBottom?: boolean }) => {
23
23
  const mobile = require('is-mobile');
24
+ const pathname = usePathname();
24
25
  const [isMobile, setIsMobile] = useState<boolean>(false);
25
26
  // const [isTop, setIsTop] = useState(true);
26
27
  //온라인상담, 전화상담
@@ -257,7 +258,7 @@ const Fix = (props: { tel: string; aceUrl?: string; wideBottom?: boolean }) => {
257
258
  useEffect(() => {
258
259
  setViewOnline(false);
259
260
  setViewCall(false);
260
- }, [router.pathname]);
261
+ }, [pathname]);
261
262
 
262
263
  return (
263
264
  <>
@@ -16,23 +16,24 @@ import { getDomainHandler, insert } from '../../lib';
16
16
  import { savePowerLinkConversion } from '../../lib';
17
17
  import Wrapper from '../Layout/Wrapper';
18
18
  import TopBtn from './TopBtn';
19
- import { useRouter } from 'next/router';
20
- import sns01 from '/public/images/footer/sns_01.webp';
21
- import sns02 from '/public/images/footer/sns_02.webp';
22
- import sns03 from '/public/images/footer/sns_03.webp';
23
- import sns04 from '/public/images/footer/sns_04.webp';
24
- import sns05 from '/public/images/footer/sns_05.webp';
19
+ import { usePathname, useRouter } from 'next/navigation';
20
+ import sns01 from '../../asset/images/footer/sns_01.webp';
21
+ import sns02 from '../../asset/images/footer/sns_02.webp';
22
+ import sns03 from '../../asset/images/footer/sns_03.webp';
23
+ import sns04 from '../../asset/images/footer/sns_04.webp';
24
+ import sns05 from '../../asset/images/footer/sns_05.webp';
25
25
  import BrochureBtn from '../BrochureBtn/BrochureBtn';
26
26
  import MedicalBrochureBtn from '../BrochureBtn/MedicalBrochureBtn';
27
27
  const NewFooter = ({ groupsData, tel, logo, aceUrl, isBrochureBtn, isLogoLong, isMedical, brochureType }) => {
28
28
  const router = useRouter();
29
+ const pathname = usePathname();
29
30
  const mobile = require('is-mobile');
30
31
  const snsClass = 'w-[44px] h-auto mr-[5px] max-md:w-[40px] max-md:m-0 max-xs:w-[45px] max-xs:mr-[17px] max-2xs:w-[40px] max-3xs:w-[35px]';
31
32
  const [isGroups, setIsGroups] = useState([]);
32
33
  const [isMobile, setIsMobile] = useState(false);
33
34
  const [isOpen, setIsOpen] = useState(false);
34
35
  const wrapperRef = useRef(null);
35
- const routeLocation = router.asPath === '/';
36
+ const routeLocation = pathname === '/';
36
37
  const fetchData = () => __awaiter(void 0, void 0, void 0, function* () {
37
38
  try {
38
39
  const req = yield fetch('/api/center/list');
@@ -44,7 +45,7 @@ const NewFooter = ({ groupsData, tel, logo, aceUrl, isBrochureBtn, isLogoLong, i
44
45
  });
45
46
  useEffect(() => {
46
47
  const fetchGroupsData = () => __awaiter(void 0, void 0, void 0, function* () {
47
- if (router.asPath !== '/') {
48
+ if (pathname !== '/') {
48
49
  try {
49
50
  const data = yield fetchData();
50
51
  setIsGroups(data); // data를 setIsGroups로 설정
@@ -55,7 +56,7 @@ const NewFooter = ({ groupsData, tel, logo, aceUrl, isBrochureBtn, isLogoLong, i
55
56
  }
56
57
  });
57
58
  fetchGroupsData();
58
- }, [router.asPath]);
59
+ }, [pathname]);
59
60
  const onClickTel = () => {
60
61
  insert('call', isMobile);
61
62
  savePowerLinkConversion('call', isMobile);
@@ -8,13 +8,13 @@ import { getDomainHandler, insert } from '../../lib';
8
8
  import { savePowerLinkConversion } from '../../lib';
9
9
  import Wrapper from '../Layout/Wrapper';
10
10
  import TopBtn from './TopBtn';
11
- import { useRouter } from 'next/router';
11
+ import { usePathname, useRouter } from 'next/navigation';
12
12
  import { IGroupsData, INewFooterTypes } from './IFooterTypes';
13
- import sns01 from '/public/images/footer/sns_01.webp';
14
- import sns02 from '/public/images/footer/sns_02.webp';
15
- import sns03 from '/public/images/footer/sns_03.webp';
16
- import sns04 from '/public/images/footer/sns_04.webp';
17
- import sns05 from '/public/images/footer/sns_05.webp';
13
+ import sns01 from '../../asset/images/footer/sns_01.webp';
14
+ import sns02 from '../../asset/images/footer/sns_02.webp';
15
+ import sns03 from '../../asset/images/footer/sns_03.webp';
16
+ import sns04 from '../../asset/images/footer/sns_04.webp';
17
+ import sns05 from '../../asset/images/footer/sns_05.webp';
18
18
  import BrochureBtn from '../BrochureBtn/BrochureBtn';
19
19
  import MedicalBrochureBtn from '../BrochureBtn/MedicalBrochureBtn';
20
20
 
@@ -33,6 +33,7 @@ const NewFooter = ({
33
33
  brochureType
34
34
  }: INewFooterTypes) => {
35
35
  const router = useRouter();
36
+ const pathname = usePathname();
36
37
  const mobile = require('is-mobile');
37
38
  const snsClass =
38
39
  'w-[44px] h-auto mr-[5px] max-md:w-[40px] max-md:m-0 max-xs:w-[45px] max-xs:mr-[17px] max-2xs:w-[40px] max-3xs:w-[35px]';
@@ -42,7 +43,7 @@ const NewFooter = ({
42
43
  const [isOpen, setIsOpen] = useState(false);
43
44
  const wrapperRef = useRef(null);
44
45
 
45
- const routeLocation: boolean = router.asPath === '/';
46
+ const routeLocation: boolean = pathname === '/';
46
47
 
47
48
  const fetchData = async () => {
48
49
  try {
@@ -55,7 +56,7 @@ const NewFooter = ({
55
56
 
56
57
  useEffect(() => {
57
58
  const fetchGroupsData = async () => {
58
- if (router.asPath !== '/') {
59
+ if (pathname !== '/') {
59
60
  try {
60
61
  const data: GroupsProps[] = await fetchData();
61
62
  setIsGroups(data); // data를 setIsGroups로 설정
@@ -66,7 +67,7 @@ const NewFooter = ({
66
67
  };
67
68
 
68
69
  fetchGroupsData();
69
- }, [router.asPath]);
70
+ }, [pathname]);
70
71
 
71
72
  const onClickTel = () => {
72
73
  insert('call', isMobile);
@@ -12,10 +12,11 @@ import 'swiper/css/pagination';
12
12
  import 'swiper/swiper-bundle.css';
13
13
  import { SwiperSlide } from 'swiper/react';
14
14
  import Link from 'next/link';
15
- import { useRouter } from 'next/router';
15
+ import { usePathname, useRouter } from 'next/navigation';
16
16
  const MapFix = (props) => {
17
17
  const { selectRegion, mapFixOpen, isGroup = true, setMapFixOpen } = props;
18
18
  const router = useRouter();
19
+ const pathname = usePathname();
19
20
  const [mapAreas, setMapAreas] = useState([]);
20
21
  const [isShow, setIsShow] = useState(true);
21
22
  const swiper = useRef(null);
@@ -64,7 +65,7 @@ const MapFix = (props) => {
64
65
  }, [selectRegion]);
65
66
  useEffect(() => {
66
67
  setMapFixOpen(false);
67
- }, [router.pathname]);
68
+ }, [pathname]);
68
69
  return (<div ref={divRef} className={'overflow-hidden rounded-t-[10px] bg-[#fff] shadow-[0px_-3px_6px_#00000029] transition-[transform,height] duration-700 ease-linear md:hidden ' +
69
70
  (mapFixOpen ? ' h-[400px] translate-y-0 ' : ' z-0 h-[0px] translate-y-[500px] ')}>
70
71
  <div className={'relative flex h-full w-full flex-col justify-between px-[30px] pb-10 pt-[30px] md:hidden '}>
@@ -13,11 +13,12 @@ import 'swiper/css/pagination';
13
13
  import 'swiper/swiper-bundle.css';
14
14
  import { SwiperSlide } from 'swiper/react';
15
15
  import Link from 'next/link';
16
- import { useRouter } from 'next/router';
16
+ import { usePathname, useRouter } from 'next/navigation';
17
17
 
18
18
  const MapFix = (props: { selectRegion: string; mapFixOpen: boolean; isGroup?: boolean; setMapFixOpen: any }) => {
19
19
  const { selectRegion, mapFixOpen, isGroup = true, setMapFixOpen } = props;
20
20
  const router = useRouter();
21
+ const pathname = usePathname();
21
22
 
22
23
  const [mapAreas, setMapAreas] = useState<{ name: string; desc: string; url: string; src: string }[]>([]);
23
24
  const [isShow, setIsShow] = useState<boolean>(true);
@@ -75,7 +76,7 @@ const MapFix = (props: { selectRegion: string; mapFixOpen: boolean; isGroup?: bo
75
76
 
76
77
  useEffect(() => {
77
78
  setMapFixOpen(false);
78
- }, [router.pathname]);
79
+ }, [pathname]);
79
80
 
80
81
  return (
81
82
  <div
@@ -4,7 +4,7 @@ import Image from 'next/image';
4
4
  import 'swiper/css';
5
5
  import 'swiper/css/navigation';
6
6
  import 'swiper/css/pagination';
7
- import { useRouter } from 'next/router';
7
+ import { useRouter } from 'next/navigation';
8
8
  import Wrapper from '../Layout/Wrapper';
9
9
  import useBrowser from '../common/hook/useBrowser';
10
10
  import AreaImage from '../MapFix/AreaImage';
@@ -5,7 +5,7 @@ import Image from 'next/image';
5
5
  import 'swiper/css';
6
6
  import 'swiper/css/navigation';
7
7
  import 'swiper/css/pagination';
8
- import { useRouter } from 'next/router';
8
+ import { useRouter } from 'next/navigation';
9
9
  import Wrapper from '../Layout/Wrapper';
10
10
  import useBrowser from '../common/hook/useBrowser';
11
11
  import AreaImage from '../MapFix/AreaImage';
@@ -2,7 +2,7 @@ import Link from 'next/link';
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import Image from 'next/image';
4
4
  import * as gtag from '../../lib/gtag';
5
- import { useRouter } from 'next/router';
5
+ import { usePathname, useRouter } from 'next/navigation';
6
6
  import MyCase from './MyCase';
7
7
  import menuXImg from '../../asset/images/header/menu_x.webp';
8
8
  import searchIcon from '../../asset/images/header/m_sr.webp';
@@ -10,9 +10,10 @@ import callLineImg from '../../asset/images/header/h_call_line_b.webp';
10
10
  import { insert, savePowerLinkConversion } from '../../lib';
11
11
  const MobileMenu = ({ handleMenuToggle, logo, opacity, menuToggle, tel, keywordArr, routes }) => {
12
12
  const router = useRouter();
13
+ const pathname = usePathname();
13
14
  const mobile = require('is-mobile');
14
15
  const [isMobile, setIsMobile] = useState(false);
15
- const currentPath = router.pathname;
16
+ const currentPath = pathname;
16
17
  const [activeMenu, setActiveMenu] = useState();
17
18
  const [search, setSearch] = useState('');
18
19
  const [isMyCaseOn, setIsMyCaseOn] = useState(false);
@@ -70,10 +71,8 @@ const MobileMenu = ({ handleMenuToggle, logo, opacity, menuToggle, tel, keywordA
70
71
  setIsMyCaseOn(false);
71
72
  };
72
73
  const reloadUrl = (url) => {
73
- if (router.pathname === url) {
74
- router.push(url).then(() => {
75
- router.reload();
76
- });
74
+ if (pathname === url) {
75
+ router.push(url);
77
76
  }
78
77
  };
79
78
  useEffect(() => {
@@ -2,7 +2,7 @@ import Link from 'next/link';
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import Image from 'next/image';
4
4
  import * as gtag from '../../lib/gtag';
5
- import { useRouter } from 'next/router';
5
+ import { usePathname, useRouter } from 'next/navigation';
6
6
  import MyCase from './MyCase';
7
7
  import { IMenuTypes } from './IMenuTypes';
8
8
 
@@ -13,10 +13,11 @@ import { insert, savePowerLinkConversion } from '../../lib';
13
13
 
14
14
  const MobileMenu = ({ handleMenuToggle, logo, opacity, menuToggle, tel, keywordArr, routes }: IMenuTypes) => {
15
15
  const router = useRouter();
16
+ const pathname = usePathname();
16
17
  const mobile = require('is-mobile');
17
18
  const [isMobile, setIsMobile] = useState<boolean>(false);
18
19
 
19
- const currentPath = router.pathname;
20
+ const currentPath = pathname;
20
21
  const [activeMenu, setActiveMenu] = useState<string>();
21
22
  const [search, setSearch] = useState<string>('');
22
23
  const [isMyCaseOn, setIsMyCaseOn] = useState<boolean>(false);
@@ -83,10 +84,8 @@ const MobileMenu = ({ handleMenuToggle, logo, opacity, menuToggle, tel, keywordA
83
84
  };
84
85
 
85
86
  const reloadUrl = (url: string) => {
86
- if (router.pathname === url) {
87
- router.push(url).then(() => {
88
- router.reload();
89
- });
87
+ if (pathname === url) {
88
+ router.push(url);
90
89
  }
91
90
  };
92
91
 
@@ -5,13 +5,14 @@ import { insert } from '../../lib';
5
5
  import * as gtag from '../../lib/gtag';
6
6
  import { savePowerLinkConversion } from '../../lib';
7
7
  import MyCase from './MyCase';
8
- import { useRouter } from 'next/router';
8
+ import { usePathname, useRouter } from 'next/navigation';
9
9
  import menuXIcon from '../../asset/images/header/menu_x.webp'; // 수정된 부분
10
10
  import callLineIcon from '../../asset/images/header/h_call_line_b.webp'; // 수정된 부분
11
11
  import newWindowIcon from '../../asset/images/header/image_b.webp'; // 수정된 부분
12
12
  const PCMenu = ({ handleMenuToggle, opacity, menuToggle, tel, routes }) => {
13
13
  const mobile = require('is-mobile');
14
14
  const [isMobile, setIsMobile] = useState(false);
15
+ const pathname = usePathname();
15
16
  const router = useRouter();
16
17
  //나의사건검색
17
18
  const [isMyCaseOn, setIsMyCaseOn] = useState(false);
@@ -38,10 +39,8 @@ const PCMenu = ({ handleMenuToggle, opacity, menuToggle, tel, routes }) => {
38
39
  }, []);
39
40
  //페이지 내부에서 쿼리 파라미터 없이 루트 경로로 돌아갈 때 새로고침
40
41
  const reloadUrl = (url) => {
41
- if (router.pathname === url) {
42
- router.push(url).then(() => {
43
- router.reload();
44
- });
42
+ if (pathname === url) {
43
+ router.push(url);
45
44
  }
46
45
  };
47
46
  return (<>
@@ -6,7 +6,7 @@ import * as gtag from '../../lib/gtag';
6
6
  import { savePowerLinkConversion } from '../../lib';
7
7
 
8
8
  import MyCase from './MyCase';
9
- import { useRouter } from 'next/router';
9
+ import { usePathname, useRouter } from 'next/navigation';
10
10
  import { IMenuTypes } from './IMenuTypes';
11
11
 
12
12
  import menuXIcon from '../../asset/images/header/menu_x.webp'; // 수정된 부분
@@ -16,7 +16,7 @@ import newWindowIcon from '../../asset/images/header/image_b.webp'; // 수정된
16
16
  const PCMenu = ({ handleMenuToggle, opacity, menuToggle, tel, routes }: IMenuTypes) => {
17
17
  const mobile = require('is-mobile');
18
18
  const [isMobile, setIsMobile] = useState<boolean>(false);
19
-
19
+ const pathname = usePathname();
20
20
  const router = useRouter();
21
21
 
22
22
  //나의사건검색
@@ -49,10 +49,8 @@ const PCMenu = ({ handleMenuToggle, opacity, menuToggle, tel, routes }: IMenuTyp
49
49
 
50
50
  //페이지 내부에서 쿼리 파라미터 없이 루트 경로로 돌아갈 때 새로고침
51
51
  const reloadUrl = (url: string) => {
52
- if (router.pathname === url) {
53
- router.push(url).then(() => {
54
- router.reload();
55
- });
52
+ if (pathname === url) {
53
+ router.push(url);
56
54
  }
57
55
  };
58
56
 
@@ -14,9 +14,10 @@ import Print from '../../asset/images/pdfPrintCopyLink/print.svg';
14
14
  import Pdf from '../../asset/images/pdfPrintCopyLink/pdf.svg';
15
15
  import Share from '../../asset/images/pdfPrintCopyLink/share.svg';
16
16
  import Loader from '../Loader/Loader';
17
- import { useRouter } from 'next/router';
17
+ import { usePathname, useRouter } from 'next/navigation';
18
18
  const PdfPrintCopyLink = (props) => {
19
19
  const router = useRouter();
20
+ const pathname = usePathname();
20
21
  const [isLoading, setIsLoading] = useState(false);
21
22
  const [clickFlag, setClickFlag] = useState({
22
23
  pdf: false,
@@ -92,7 +93,7 @@ const PdfPrintCopyLink = (props) => {
92
93
  };
93
94
  return (<div className={'mt-[14px] flex w-full cursor-pointer items-center justify-end sm:mb-[10px] sm:mt-[32px]'}>
94
95
  {isLoading ? <Loader fullScreen/> : <></>}
95
- {router.pathname.includes('success_template') ? (<></>) : (<>
96
+ {pathname.includes('success_template') ? (<></>) : (<>
96
97
  <Pdf className={'h-[38px] w-[38px] max-sm:h-7 max-sm:w-7 ' +
97
98
  (clickFlag.pdf ? ' fill-[#0D2B4F]' : ' fill-[#6c6c6c]')} onClick={handleGetPdf}/>
98
99
  <Print className={'ml-2 h-[42px] w-[42px] cursor-pointer max-sm:ml-[7px] max-sm:h-8 max-sm:w-8 ' +
@@ -6,10 +6,11 @@ import Print from '../../asset/images/pdfPrintCopyLink/print.svg';
6
6
  import Pdf from '../../asset/images/pdfPrintCopyLink/pdf.svg';
7
7
  import Share from '../../asset/images/pdfPrintCopyLink/share.svg';
8
8
  import Loader from '../Loader/Loader';
9
- import { useRouter } from 'next/router';
9
+ import { usePathname, useRouter } from 'next/navigation';
10
10
 
11
11
  const PdfPrintCopyLink = (props: { fileName: string; printRef?: React.RefObject<any> }) => {
12
12
  const router = useRouter();
13
+ const pathname = usePathname();
13
14
  const [isLoading, setIsLoading] = useState<boolean>(false);
14
15
  const [clickFlag, setClickFlag] = useState<{ print: boolean; pdf: boolean; link: boolean }>({
15
16
  pdf: false,
@@ -92,7 +93,7 @@ const PdfPrintCopyLink = (props: { fileName: string; printRef?: React.RefObject<
92
93
  return (
93
94
  <div className={'mt-[14px] flex w-full cursor-pointer items-center justify-end sm:mb-[10px] sm:mt-[32px]'}>
94
95
  {isLoading ? <Loader fullScreen /> : <></>}
95
- {router.pathname.includes('success_template') ? (
96
+ {pathname.includes('success_template') ? (
96
97
  <></>
97
98
  ) : (
98
99
  <>
@@ -15,7 +15,7 @@ import { bodyFetch, formatPhoneNumber, insert, savePowerLinkConversion } from '.
15
15
  import { SelectBox } from '../../SelectBox/SelectBox';
16
16
  import axios from 'axios';
17
17
  import mobile from 'is-mobile';
18
- import { useRouter } from 'next/router';
18
+ import { useRouter } from 'next/navigation';
19
19
  import ChoiceLock from '../../../asset/images/consulting/choice_lock.webp';
20
20
  import NewChoiceConsulting from '../../../asset/images/consulting/new_choice_consulting.webp';
21
21
  import Loader from '../../Loader/Loader';
@@ -116,7 +116,7 @@ const Index = (props) => {
116
116
  }
117
117
  if (!obj.isNotComplete) {
118
118
  savePowerLinkConversion('online', isMobile);
119
- router.push({ pathname: '/complete', query: { isConsult: true } }, '/complete');
119
+ router.push('/complete?isConsult=true');
120
120
  }
121
121
  }
122
122
  else {
@@ -8,7 +8,7 @@ import { bodyFetch, formatPhoneNumber, insert, savePowerLinkConversion } from '.
8
8
  import { SelectBox } from '../../SelectBox/SelectBox';
9
9
  import axios from 'axios';
10
10
  import mobile from 'is-mobile';
11
- import { useRouter } from 'next/router';
11
+ import { useRouter } from 'next/navigation';
12
12
  import ChoiceLock from '../../../asset/images/consulting/choice_lock.webp';
13
13
  import NewChoiceConsulting from '../../../asset/images/consulting/new_choice_consulting.webp';
14
14
  import Loader from '../../Loader/Loader';
@@ -129,7 +129,7 @@ const Index = (props: { ace_Click?: () => void }) => {
129
129
 
130
130
  if (!obj.isNotComplete) {
131
131
  savePowerLinkConversion('online', isMobile);
132
- router.push({ pathname: '/complete', query: { isConsult: true } }, '/complete');
132
+ router.push('/complete?isConsult=true');
133
133
  }
134
134
  } else {
135
135
  alert('상담 신청에 실패했습니다. 잠시후 다시 시도해주세요.');