@daeryun/dr_components 0.4.54 → 0.4.56

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 (30) hide show
  1. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  2. package/dist/components/common/integrate/index.d.ts +1 -1
  3. package/dist/components/page/Integrate/Broadcast.d.ts +1 -0
  4. package/dist/components/page/Integrate/Broadcast.jsx +81 -48
  5. package/dist/components/page/Integrate/Broadcast.tsx +153 -114
  6. package/dist/components/page/Integrate/Field.d.ts +1 -0
  7. package/dist/components/page/Integrate/Field.jsx +40 -16
  8. package/dist/components/page/Integrate/Field.tsx +66 -32
  9. package/dist/components/page/Integrate/LawInfo.d.ts +1 -0
  10. package/dist/components/page/Integrate/LawInfo.jsx +37 -4
  11. package/dist/components/page/Integrate/LawInfo.tsx +51 -5
  12. package/dist/components/page/Integrate/Lawyer.d.ts +1 -0
  13. package/dist/components/page/Integrate/Lawyer.jsx +36 -11
  14. package/dist/components/page/Integrate/Lawyer.tsx +60 -25
  15. package/dist/components/page/Integrate/Map.d.ts +1 -0
  16. package/dist/components/page/Integrate/Map.jsx +41 -26
  17. package/dist/components/page/Integrate/Map.tsx +53 -34
  18. package/dist/components/page/Integrate/Reply.d.ts +1 -0
  19. package/dist/components/page/Integrate/Reply.jsx +55 -22
  20. package/dist/components/page/Integrate/Reply.tsx +102 -60
  21. package/dist/components/page/Integrate/SearchData.jsx +21 -7
  22. package/dist/components/page/Integrate/SearchData.tsx +22 -0
  23. package/dist/components/page/Integrate/Success.d.ts +1 -0
  24. package/dist/components/page/Integrate/Success.jsx +61 -28
  25. package/dist/components/page/Integrate/Success.tsx +106 -62
  26. package/dist/components/page/Integrate/ViewMore.d.ts +1 -1
  27. package/dist/components/page/Integrate/ViewMore.tsx +1 -1
  28. package/dist/styles/globals.css +177 -177
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import Link from 'next/link';
3
3
  import Image from 'next/image';
4
4
  import { NoResult } from './NoResult';
@@ -6,15 +6,45 @@ import { Title } from './Title';
6
6
  import { ViewMore } from './ViewMore';
7
7
  import { searchColorText } from '../../common/integrate';
8
8
  const LawInfo = (props) => {
9
- const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
9
+ const { tab, onMoreViewText, list, pages, onMoreView, search, isMobileSize, listCount } = props;
10
10
  const [loading, setLoading] = useState(false);
11
+ const [allTabPage, setAllTabPage] = useState(0);
12
+ const [allTabList, setAllTabList] = useState([]);
13
+ const getAllPage = () => {
14
+ const itemsToAdd = 4;
15
+ // infoList에서 잘라낼 시작 인덱스 계산
16
+ const startIndex = 2 + allTabPage * 4;
17
+ const endIndex = startIndex + itemsToAdd;
18
+ const newItems = list.infoList.slice(startIndex, endIndex);
19
+ const updatedList = [...allTabList, ...newItems];
20
+ setAllTabList(updatedList);
21
+ // 다음 호출 후 예상 총 개수
22
+ const nextTotalCount = updatedList.length + itemsToAdd;
23
+ // 현재 successList의 길이
24
+ const currentListLength = list.infoList.length;
25
+ // 다음 총 개수가 infoList 길이를 초과하면 api 호출
26
+ // 예: infoList가 24일 때, 22 -> 26이 되면 호출
27
+ if (nextTotalCount > currentListLength) {
28
+ onMoreView();
29
+ }
30
+ // 페이지 상태 증가
31
+ setAllTabPage(allTabPage + 1);
32
+ };
33
+ useEffect(() => {
34
+ if (allTabList.length === 0) {
35
+ setAllTabList(list.infoList.slice(0, 2));
36
+ }
37
+ }, [list.infoList]);
11
38
  return (<>
12
39
  {tab === '전체' || tab === 'info' ? (tab === 'info' && listCount.info < 1 ? (<NoResult />) : (<>
13
40
  {listCount.info > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
14
41
  <Title title={'법률정보'} tab={tab} type={'info'} onClick={str => onMoreViewText(str)} count={listCount.info}/>
15
-
16
42
  <div className={'grid w-full gap-[40px] sm:grid-cols-2 sm:gap-[30px] lg:grid-cols-4 lg:gap-[16px]'}>
17
- {(tab === '전체' ? list.infoList.slice(0, 4) : list.infoList).map((item, index) => {
43
+ {(tab === '전체'
44
+ ? isMobileSize === true
45
+ ? allTabList
46
+ : list.infoList.slice(0, 4)
47
+ : list.infoList).map((item, index) => {
18
48
  return (<Link key={item.pathname + 'lawinfo_new/' + item.idx} href={item.pathname + 'lawinfo_new/' + item.idx} target={item.center_code === props.center_code ? '' : '_blank'} className={'mb-3 flex flex-col gap-3 overflow-hidden'}>
19
49
  <div className={'relative aspect-[1.47] w-full overflow-hidden max-sm:h-full max-sm:w-full'}>
20
50
  <Image src={'https://d1tgonli21s4df.cloudfront.net' + item.img} alt={item.alt} fill sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 25vw" className={'h-full w-full object-contain '}/>
@@ -29,6 +59,9 @@ const LawInfo = (props) => {
29
59
  setLoading(true);
30
60
  onMoreView();
31
61
  setLoading(false);
62
+ }}/>)}
63
+ {tab === '전체' && isMobileSize === true && (<ViewMore flag={allTabList.length != listCount.info} func={() => {
64
+ getAllPage();
32
65
  }}/>)}
33
66
  </div>) : (<></>)}
34
67
  </>)) : null}
@@ -1,13 +1,14 @@
1
- import React, { useRef, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
2
  import Link from 'next/link';
3
3
  import Image from 'next/image';
4
4
  import { NoResult } from './NoResult';
5
- import { IListPagesType, IListTypes } from './integrateType';
5
+ import { IInfoTypes, IListPagesType, IListTypes } from './integrateType';
6
6
  import { Title } from './Title';
7
7
  import { ViewMore } from './ViewMore';
8
8
  import { searchColorText } from '../../common/integrate';
9
9
 
10
10
  const LawInfo = (props: {
11
+ isMobileSize: boolean | null;
11
12
  tab: string;
12
13
  onMoreViewText: (str: string) => void;
13
14
  onMoreView: () => void;
@@ -25,8 +26,41 @@ const LawInfo = (props: {
25
26
  };
26
27
  search: string;
27
28
  }) => {
28
- const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
29
+ const { tab, onMoreViewText, list, pages, onMoreView, search, isMobileSize, listCount } = props;
29
30
  const [loading, setLoading] = useState<boolean>(false);
31
+ const [allTabPage, setAllTabPage] = useState<number>(0);
32
+ const [allTabList, setAllTabList] = useState<IInfoTypes[]>([]);
33
+
34
+ const getAllPage = () => {
35
+ const itemsToAdd = 4;
36
+
37
+ // infoList에서 잘라낼 시작 인덱스 계산
38
+ const startIndex = 2 + allTabPage * 4;
39
+ const endIndex = startIndex + itemsToAdd;
40
+ const newItems = list.infoList.slice(startIndex, endIndex);
41
+ const updatedList = [...allTabList, ...newItems];
42
+ setAllTabList(updatedList);
43
+
44
+ // 다음 호출 후 예상 총 개수
45
+ const nextTotalCount = updatedList.length + itemsToAdd;
46
+ // 현재 successList의 길이
47
+ const currentListLength = list.infoList.length;
48
+
49
+ // 다음 총 개수가 infoList 길이를 초과하면 api 호출
50
+ // 예: infoList가 24일 때, 22 -> 26이 되면 호출
51
+ if (nextTotalCount > currentListLength) {
52
+ onMoreView();
53
+ }
54
+
55
+ // 페이지 상태 증가
56
+ setAllTabPage(allTabPage + 1);
57
+ };
58
+
59
+ useEffect(() => {
60
+ if (allTabList.length === 0) {
61
+ setAllTabList(list.infoList.slice(0, 2));
62
+ }
63
+ }, [list.infoList]);
30
64
 
31
65
  return (
32
66
  <>
@@ -44,13 +78,17 @@ const LawInfo = (props: {
44
78
  onClick={str => onMoreViewText(str)}
45
79
  count={listCount.info}
46
80
  />
47
-
48
81
  <div
49
82
  className={
50
83
  'grid w-full gap-[40px] sm:grid-cols-2 sm:gap-[30px] lg:grid-cols-4 lg:gap-[16px]'
51
84
  }
52
85
  >
53
- {(tab === '전체' ? list.infoList.slice(0, 4) : list.infoList).map((item, index) => {
86
+ {(tab === '전체'
87
+ ? isMobileSize === true
88
+ ? allTabList
89
+ : list.infoList.slice(0, 4)
90
+ : list.infoList
91
+ ).map((item, index) => {
54
92
  return (
55
93
  <Link
56
94
  key={item.pathname + 'lawinfo_new/' + item.idx}
@@ -95,6 +133,14 @@ const LawInfo = (props: {
95
133
  }}
96
134
  />
97
135
  )}
136
+ {tab === '전체' && isMobileSize === true && (
137
+ <ViewMore
138
+ flag={allTabList.length != listCount.info}
139
+ func={() => {
140
+ getAllPage();
141
+ }}
142
+ />
143
+ )}
98
144
  </div>
99
145
  ) : (
100
146
  <></>
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IListPagesType, IListTypes } from './integrateType';
3
3
  declare const Lawyer: (props: {
4
+ isMobileSize: boolean | null;
4
5
  tab: string;
5
6
  onMoreViewText: (str: string) => void;
6
7
  onMoreView: () => void;
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
2
2
  import { NoResult } from './NoResult';
3
3
  import { Title } from './Title';
4
4
  import { ViewMore } from './ViewMore';
5
- import * as gtag from '../../../lib/gtag';
6
5
  import mobile from 'is-mobile';
7
6
  import { useRouter } from 'next/router';
8
7
  import Link from 'next/link';
@@ -10,7 +9,7 @@ import Image from 'next/image';
10
9
  import style from './index.module.css';
11
10
  import Mark from '../../Mark/Mark';
12
11
  const Lawyer = (props) => {
13
- const { tab, onMoreViewText, list, pages, listCount } = props;
12
+ const { tab, onMoreViewText, list, pages, listCount, isMobileSize } = props;
14
13
  const [loading, setLoading] = useState(false);
15
14
  const [isMobile, setIsMobile] = useState(false);
16
15
  const lawyerImagePath = 'https://d1tgonli21s4df.cloudfront.net/upload/lawyer';
@@ -18,6 +17,33 @@ const Lawyer = (props) => {
18
17
  const is_mobile = mobile();
19
18
  setIsMobile(is_mobile);
20
19
  }, []);
20
+ const [allTabPage, setAllTabPage] = useState(0);
21
+ const [allTabList, setAllTabList] = useState([]);
22
+ const getAllPage = () => {
23
+ const itemsToAdd = 6;
24
+ // lawyerList에서 잘라낼 시작 인덱스 계산
25
+ const startIndex = 6 + allTabPage * 6;
26
+ const endIndex = startIndex + itemsToAdd;
27
+ const newItems = list.lawyerList.slice(startIndex, endIndex);
28
+ const updatedList = [...allTabList, ...newItems];
29
+ setAllTabList(updatedList);
30
+ // 다음 호출 후 예상 총 개수
31
+ const nextTotalCount = updatedList.length + itemsToAdd;
32
+ // 현재 lawyerList의 길이
33
+ const currentListLength = list.lawyerList.length;
34
+ // 다음 총 개수가 lawyerList 길이를 초과하면 api 호출
35
+ // 예: lawyerList가 24일 때, 22 -> 26이 되면 호출
36
+ if (nextTotalCount > currentListLength) {
37
+ props.onMoreView();
38
+ }
39
+ // 페이지 상태 증가
40
+ setAllTabPage(allTabPage + 1);
41
+ };
42
+ useEffect(() => {
43
+ if (allTabList.length === 0) {
44
+ setAllTabList(list.lawyerList.slice(0, 6));
45
+ }
46
+ }, [list.lawyerList]);
21
47
  return props.tab === '전체' || props.tab === 'lawyer' ? (
22
48
  //구성원 탭에서는 결과 없음
23
49
  tab === 'lawyer' && listCount.lawyer < 1 ? (<NoResult />) : (<>
@@ -26,7 +52,11 @@ const Lawyer = (props) => {
26
52
  <Title title={'구성원'} tab={tab} type={'lawyer'} onClick={str => onMoreViewText(str)} count={listCount.lawyer}/>
27
53
 
28
54
  <div className={'mx-auto my-16 grid w-full grid-cols-2 gap-y-5 max-md:gap-y-2 md:grid-cols-3 xl:grid-cols-4'}>
29
- {(tab === '전체' ? list.lawyerList.slice(0, 8) : list.lawyerList).map((item, index) => {
55
+ {(tab === '전체'
56
+ ? isMobileSize === true
57
+ ? allTabList
58
+ : list.lawyerList.slice(0, 8)
59
+ : list.lawyerList).map((item, index) => {
30
60
  return (<LawyerContainer key={item.id} center_code={props.center_code} item={item} lawyerImagePath={lawyerImagePath}/>);
31
61
  })}
32
62
  </div>
@@ -35,6 +65,9 @@ const Lawyer = (props) => {
35
65
  props.onMoreView();
36
66
  setLoading(false);
37
67
  }} loading={loading} totalPage={Math.ceil(listCount.lawyer / 12)} nowPage={pages.lawyerList}/>)}
68
+ {tab === '전체' && isMobileSize === true && (<ViewMore flag={allTabList.length != listCount.lawyer} func={() => {
69
+ getAllPage();
70
+ }}/>)}
38
71
  </div>) : (<></>)}
39
72
  </>)) : null;
40
73
  };
@@ -43,14 +76,6 @@ const LawyerContainer = (props) => {
43
76
  var _a;
44
77
  const { item, lawyerImagePath, selectedFilter = '', onClickTel, isPro = false } = props;
45
78
  const router = useRouter();
46
- const MailClick = () => {
47
- gtag.event({
48
- action: 'mail_complete',
49
- category: 'mail',
50
- label: '변호사이메일버튼',
51
- value: '1'
52
- });
53
- };
54
79
  if (!isPro) {
55
80
  return (<span className={'relative flex justify-center'}>
56
81
  <div className={'flex w-[95%] flex-col sm:w-[80%]'}>
@@ -1,10 +1,8 @@
1
- import React, { RefObject, useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { NoResult } from './NoResult';
3
3
  import { Title } from './Title';
4
4
  import { ILawyerTypes, IListPagesType, IListTypes } from './integrateType';
5
5
  import { ViewMore } from './ViewMore';
6
-
7
- import * as gtag from '../../../lib/gtag';
8
6
  import mobile from 'is-mobile';
9
7
  import { useRouter } from 'next/router';
10
8
  import Link from 'next/link';
@@ -13,6 +11,7 @@ import style from './index.module.css';
13
11
  import Mark from '../../Mark/Mark';
14
12
 
15
13
  const Lawyer = (props: {
14
+ isMobileSize: boolean | null;
16
15
  tab: string;
17
16
  onMoreViewText: (str: string) => void;
18
17
  onMoreView: () => void;
@@ -29,7 +28,7 @@ const Lawyer = (props: {
29
28
  map: number;
30
29
  };
31
30
  }) => {
32
- const { tab, onMoreViewText, list, pages, listCount } = props;
31
+ const { tab, onMoreViewText, list, pages, listCount, isMobileSize } = props;
33
32
 
34
33
  const [loading, setLoading] = useState<boolean>(false);
35
34
  const [isMobile, setIsMobile] = useState<boolean>(false);
@@ -40,6 +39,40 @@ const Lawyer = (props: {
40
39
  setIsMobile(is_mobile);
41
40
  }, []);
42
41
 
42
+ const [allTabPage, setAllTabPage] = useState<number>(0);
43
+ const [allTabList, setAllTabList] = useState<ILawyerTypes[]>([]);
44
+
45
+ const getAllPage = () => {
46
+ const itemsToAdd = 6;
47
+
48
+ // lawyerList에서 잘라낼 시작 인덱스 계산
49
+ const startIndex = 6 + allTabPage * 6;
50
+ const endIndex = startIndex + itemsToAdd;
51
+ const newItems = list.lawyerList.slice(startIndex, endIndex);
52
+ const updatedList = [...allTabList, ...newItems];
53
+ setAllTabList(updatedList);
54
+
55
+ // 다음 호출 후 예상 총 개수
56
+ const nextTotalCount = updatedList.length + itemsToAdd;
57
+ // 현재 lawyerList의 길이
58
+ const currentListLength = list.lawyerList.length;
59
+
60
+ // 다음 총 개수가 lawyerList 길이를 초과하면 api 호출
61
+ // 예: lawyerList가 24일 때, 22 -> 26이 되면 호출
62
+ if (nextTotalCount > currentListLength) {
63
+ props.onMoreView();
64
+ }
65
+
66
+ // 페이지 상태 증가
67
+ setAllTabPage(allTabPage + 1);
68
+ };
69
+
70
+ useEffect(() => {
71
+ if (allTabList.length === 0) {
72
+ setAllTabList(list.lawyerList.slice(0, 6));
73
+ }
74
+ }, [list.lawyerList]);
75
+
43
76
  return props.tab === '전체' || props.tab === 'lawyer' ? (
44
77
  //구성원 탭에서는 결과 없음
45
78
  tab === 'lawyer' && listCount.lawyer < 1 ? (
@@ -62,18 +95,21 @@ const Lawyer = (props: {
62
95
  'mx-auto my-16 grid w-full grid-cols-2 gap-y-5 max-md:gap-y-2 md:grid-cols-3 xl:grid-cols-4'
63
96
  }
64
97
  >
65
- {(tab === '전체' ? list.lawyerList.slice(0, 8) : list.lawyerList).map(
66
- (item, index: number) => {
67
- return (
68
- <LawyerContainer
69
- key={item.id}
70
- center_code={props.center_code}
71
- item={item}
72
- lawyerImagePath={lawyerImagePath}
73
- />
74
- );
75
- }
76
- )}
98
+ {(tab === '전체'
99
+ ? isMobileSize === true
100
+ ? allTabList
101
+ : list.lawyerList.slice(0, 8)
102
+ : list.lawyerList
103
+ ).map((item, index: number) => {
104
+ return (
105
+ <LawyerContainer
106
+ key={item.id}
107
+ center_code={props.center_code}
108
+ item={item}
109
+ lawyerImagePath={lawyerImagePath}
110
+ />
111
+ );
112
+ })}
77
113
  </div>
78
114
  {tab != '전체' && (
79
115
  <ViewMore
@@ -88,6 +124,14 @@ const Lawyer = (props: {
88
124
  nowPage={pages.lawyerList}
89
125
  />
90
126
  )}
127
+ {tab === '전체' && isMobileSize === true && (
128
+ <ViewMore
129
+ flag={allTabList.length != listCount.lawyer}
130
+ func={() => {
131
+ getAllPage();
132
+ }}
133
+ />
134
+ )}
91
135
  </div>
92
136
  ) : (
93
137
  <></>
@@ -114,15 +158,6 @@ const LawyerContainer = (props: {
114
158
  const { item, lawyerImagePath, selectedFilter = '', onClickTel, isPro = false } = props;
115
159
  const router = useRouter();
116
160
 
117
- const MailClick = () => {
118
- gtag.event({
119
- action: 'mail_complete',
120
- category: 'mail',
121
- label: '변호사이메일버튼',
122
- value: '1'
123
- });
124
- };
125
-
126
161
  if (!isPro) {
127
162
  return (
128
163
  <span className={'relative flex justify-center'}>
@@ -1,6 +1,7 @@
1
1
  import { IListPagesType, IListTypes } from './integrateType';
2
2
  import React from 'react';
3
3
  declare const Map: (props: {
4
+ isMobileSize: boolean | null;
4
5
  tab: string;
5
6
  onMoreViewText: (str: string) => void;
6
7
  onMoreView: () => void;
@@ -1,13 +1,4 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import React, { useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
11
2
  import Image from 'next/image';
12
3
  import { NoResult } from './NoResult';
13
4
  import { Title } from './Title';
@@ -16,25 +7,49 @@ import { useRouter } from 'next/router';
16
7
  import { searchColorText } from '../../common/integrate';
17
8
  const Map = (props) => {
18
9
  const router = useRouter();
19
- const { tab, onMoreViewText, list, pages } = props;
10
+ const { tab, onMoreViewText, list, isMobileSize, pages } = props;
20
11
  const [loading, setLoading] = useState(false);
12
+ const [allTabPage, setAllTabPage] = useState(0);
13
+ const [allTabList, setAllTabList] = useState([]);
14
+ const getAllPage = () => {
15
+ const itemsToAdd = 5;
16
+ // imapList에서 잘라낼 시작 인덱스 계산
17
+ const startIndex = 5 + allTabPage * 5;
18
+ const endIndex = startIndex + itemsToAdd;
19
+ const newItems = list.mapList.slice(startIndex, endIndex);
20
+ const updatedList = [...allTabList, ...newItems];
21
+ setAllTabList(updatedList);
22
+ // 다음 호출 후 예상 총 개수
23
+ const nextTotalCount = updatedList.length + itemsToAdd;
24
+ // 현재 successList의 길이
25
+ const currentListLength = list.mapList.length;
26
+ // 다음 총 개수가 mapList 길이를 초과하면 api 호출
27
+ // 예: mapList가 24일 때, 22 -> 26이 되면 호출
28
+ if (nextTotalCount > currentListLength) {
29
+ props.onMoreView();
30
+ }
31
+ // 페이지 상태 증가
32
+ setAllTabPage(allTabPage + 1);
33
+ };
34
+ useEffect(() => {
35
+ if (allTabList.length === 0) {
36
+ setAllTabList(list.mapList.slice(0, 5));
37
+ }
38
+ }, [list.mapList]);
21
39
  return props.tab === '전체' || props.tab === 'map' ? (
22
40
  //구성원 탭에서는 결과 없음
23
41
  tab === 'map' && props.listCount.map < 1 ? (<NoResult />) : (<>
24
42
  {/*전체 탭에서는 없게*/}
25
43
  {props.listCount.map > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
26
- <Title title={'오시는길'} tab={tab} type={'map'} count={props.listCount.map} onClick={() => __awaiter(void 0, void 0, void 0, function* () {
27
- yield router.push('/map');
28
- })}/>
29
-
44
+ <Title title={'오시는길'} tab={tab} type={'map'} count={props.listCount.map} onClick={str => onMoreViewText(str)}/>
30
45
  <div className={'mt-[-1.5rem] w-full'}>
31
- {(tab === '전체' && !props.search && list.mainMapList
32
- ? list.mainMapList.slice(0, 5)
33
- : tab === '전체' && props.search
34
- ? list.mapList.slice(0, 5)
35
- : list.mapList).map((item, index) => {
46
+ {(tab === '전체'
47
+ ? isMobileSize === true
48
+ ? allTabList
49
+ : list.mapList.slice(0, 5)
50
+ : list.mapList).map((item, index) => {
36
51
  var _a, _b, _c;
37
- return (<div key={'integrate_' + item.key} className={'group/mapBox flex gap-[60px] border-b-[1px] border-solid border-[#DDDDDD] hover:bg-[#FCFCFC] ' +
52
+ return (<div key={'integrate_map' + item.key} className={'group/mapBox flex gap-[60px] border-b-[1px] border-solid border-[#DDDDDD] hover:bg-[#FCFCFC] ' +
38
53
  //1280px
39
54
  'max-xl:gap-[0] ' +
40
55
  //1024px
@@ -95,14 +110,14 @@ const Map = (props) => {
95
110
  </div>);
96
111
  })}
97
112
  </div>
98
- {tab != '전체' ? (<ViewMore flag={list.mapList.length != props.listCount.map} func={() => {
113
+ {tab != '전체' && (<ViewMore flag={list.mapList.length != props.listCount.map} func={() => {
99
114
  setLoading(true);
100
115
  props.onMoreView();
101
116
  setLoading(false);
102
- }} loading={loading} totalPage={Math.ceil(props.listCount.map / 12)} nowPage={pages.mapList}/>) : (<button className={'relative m-auto mb-20 mt-20 flex w-[10em] cursor-pointer items-center justify-between border-[1px] border-solid border-[#707070] px-5 py-4 text-[#666666]'} onClick={str => onMoreViewText('map')} aria-label={'오시는길 더보기'}>
103
- <span className={'pt-[2px] leading-[15px] text-[#666666] '}>더보기</span>
104
- <Image src={'/images/plus_g.webp'} alt={'+'} title={'+'} width={30} height={30} className={'aspect-square w-[18px] max-lg:w-[16px] max-sm:w-[15px] max-2xs:w-[13px]'}/>
105
- </button>)}
117
+ }} loading={loading} totalPage={Math.ceil(props.listCount.map / 12)} nowPage={pages.mapList}/>)}
118
+ {tab === '전체' && isMobileSize === true && (<ViewMore flag={allTabList.length != props.listCount.map} func={() => {
119
+ getAllPage();
120
+ }}/>)}
106
121
  </div>) : (<></>)}
107
122
  </>)) : null;
108
123
  };
@@ -1,5 +1,5 @@
1
- import { IListPagesType, IListTypes } from './integrateType';
2
- import React, { useRef, useState } from 'react';
1
+ import { IListPagesType, IListTypes, IMapTypes } from './integrateType';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
3
  import Image from 'next/image';
4
4
  import { useTranslation } from 'next-i18next';
5
5
  import { NoResult } from './NoResult';
@@ -9,6 +9,7 @@ import { useRouter } from 'next/router';
9
9
  import { searchColorText } from '../../common/integrate';
10
10
 
11
11
  const Map = (props: {
12
+ isMobileSize: boolean | null;
12
13
  tab: string;
13
14
  onMoreViewText: (str: string) => void;
14
15
  onMoreView: () => void;
@@ -26,9 +27,42 @@ const Map = (props: {
26
27
  };
27
28
  }) => {
28
29
  const router = useRouter();
29
- const { tab, onMoreViewText, list, pages } = props;
30
+ const { tab, onMoreViewText, list, isMobileSize, pages } = props;
30
31
 
31
32
  const [loading, setLoading] = useState<boolean>(false);
33
+ const [allTabPage, setAllTabPage] = useState<number>(0);
34
+ const [allTabList, setAllTabList] = useState<IMapTypes[]>([]);
35
+
36
+ const getAllPage = () => {
37
+ const itemsToAdd = 5;
38
+
39
+ // imapList에서 잘라낼 시작 인덱스 계산
40
+ const startIndex = 5 + allTabPage * 5;
41
+ const endIndex = startIndex + itemsToAdd;
42
+ const newItems = list.mapList.slice(startIndex, endIndex);
43
+ const updatedList = [...allTabList, ...newItems];
44
+ setAllTabList(updatedList);
45
+
46
+ // 다음 호출 후 예상 총 개수
47
+ const nextTotalCount = updatedList.length + itemsToAdd;
48
+ // 현재 successList의 길이
49
+ const currentListLength = list.mapList.length;
50
+
51
+ // 다음 총 개수가 mapList 길이를 초과하면 api 호출
52
+ // 예: mapList가 24일 때, 22 -> 26이 되면 호출
53
+ if (nextTotalCount > currentListLength) {
54
+ props.onMoreView();
55
+ }
56
+
57
+ // 페이지 상태 증가
58
+ setAllTabPage(allTabPage + 1);
59
+ };
60
+
61
+ useEffect(() => {
62
+ if (allTabList.length === 0) {
63
+ setAllTabList(list.mapList.slice(0, 5));
64
+ }
65
+ }, [list.mapList]);
32
66
 
33
67
  return props.tab === '전체' || props.tab === 'map' ? (
34
68
  //구성원 탭에서는 결과 없음
@@ -44,21 +78,18 @@ const Map = (props: {
44
78
  tab={tab}
45
79
  type={'map'}
46
80
  count={props.listCount.map}
47
- onClick={async () => {
48
- await router.push('/map');
49
- }}
81
+ onClick={str => onMoreViewText(str)}
50
82
  />
51
-
52
83
  <div className={'mt-[-1.5rem] w-full'}>
53
- {(tab === '전체' && !props.search && list.mainMapList
54
- ? list.mainMapList.slice(0, 5)
55
- : tab === '전체' && props.search
56
- ? list.mapList.slice(0, 5)
57
- : list.mapList
84
+ {(tab === '전체'
85
+ ? isMobileSize === true
86
+ ? allTabList
87
+ : list.mapList.slice(0, 5)
88
+ : list.mapList
58
89
  ).map((item, index: number) => {
59
90
  return (
60
91
  <div
61
- key={'integrate_' + item.key}
92
+ key={'integrate_map' + item.key}
62
93
  className={
63
94
  'group/mapBox flex gap-[60px] border-b-[1px] border-solid border-[#DDDDDD] hover:bg-[#FCFCFC] ' +
64
95
  //1280px
@@ -180,7 +211,7 @@ const Map = (props: {
180
211
  );
181
212
  })}
182
213
  </div>
183
- {tab != '전체' ? (
214
+ {tab != '전체' && (
184
215
  <ViewMore
185
216
  flag={list.mapList.length != props.listCount.map}
186
217
  func={() => {
@@ -192,26 +223,14 @@ const Map = (props: {
192
223
  totalPage={Math.ceil(props.listCount.map / 12)}
193
224
  nowPage={pages.mapList}
194
225
  />
195
- ) : (
196
- <button
197
- className={
198
- 'relative m-auto mb-20 mt-20 flex w-[10em] cursor-pointer items-center justify-between border-[1px] border-solid border-[#707070] px-5 py-4 text-[#666666]'
199
- }
200
- onClick={str => onMoreViewText('map')}
201
- aria-label={'오시는길 더보기'}
202
- >
203
- <span className={'pt-[2px] leading-[15px] text-[#666666] '}>더보기</span>
204
- <Image
205
- src={'/images/plus_g.webp'}
206
- alt={'+'}
207
- title={'+'}
208
- width={30}
209
- height={30}
210
- className={
211
- 'aspect-square w-[18px] max-lg:w-[16px] max-sm:w-[15px] max-2xs:w-[13px]'
212
- }
213
- />
214
- </button>
226
+ )}
227
+ {tab === '전체' && isMobileSize === true && (
228
+ <ViewMore
229
+ flag={allTabList.length != props.listCount.map}
230
+ func={() => {
231
+ getAllPage();
232
+ }}
233
+ />
215
234
  )}
216
235
  </div>
217
236
  ) : (
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IListPagesType, IListTypes } from './integrateType';
3
3
  declare const Reply: (props: {
4
+ isMobileSize: boolean | null;
4
5
  tab: string;
5
6
  onMoreViewText: (str: string) => void;
6
7
  onMoreView: () => void;