@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.
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/components/page/Integrate/Broadcast.d.ts +1 -0
- package/dist/components/page/Integrate/Broadcast.jsx +81 -48
- package/dist/components/page/Integrate/Broadcast.tsx +153 -114
- package/dist/components/page/Integrate/Field.d.ts +1 -0
- package/dist/components/page/Integrate/Field.jsx +40 -16
- package/dist/components/page/Integrate/Field.tsx +66 -32
- package/dist/components/page/Integrate/LawInfo.d.ts +1 -0
- package/dist/components/page/Integrate/LawInfo.jsx +37 -4
- package/dist/components/page/Integrate/LawInfo.tsx +51 -5
- package/dist/components/page/Integrate/Lawyer.d.ts +1 -0
- package/dist/components/page/Integrate/Lawyer.jsx +36 -11
- package/dist/components/page/Integrate/Lawyer.tsx +60 -25
- package/dist/components/page/Integrate/Map.d.ts +1 -0
- package/dist/components/page/Integrate/Map.jsx +41 -26
- package/dist/components/page/Integrate/Map.tsx +53 -34
- package/dist/components/page/Integrate/Reply.d.ts +1 -0
- package/dist/components/page/Integrate/Reply.jsx +55 -22
- package/dist/components/page/Integrate/Reply.tsx +102 -60
- package/dist/components/page/Integrate/SearchData.jsx +21 -7
- package/dist/components/page/Integrate/SearchData.tsx +22 -0
- package/dist/components/page/Integrate/Success.d.ts +1 -0
- package/dist/components/page/Integrate/Success.jsx +61 -28
- package/dist/components/page/Integrate/Success.tsx +106 -62
- package/dist/components/page/Integrate/ViewMore.d.ts +1 -1
- package/dist/components/page/Integrate/ViewMore.tsx +1 -1
- package/dist/styles/globals.css +177 -177
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import { NoResult } from './NoResult';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
|
-
import { IListPagesType, IListTypes } from './integrateType';
|
|
7
|
+
import { IBroadCastTypes, IListPagesType, IListTypes } from './integrateType';
|
|
8
8
|
import { Title } from './Title';
|
|
9
9
|
import { ViewMore } from './ViewMore';
|
|
10
10
|
import { searchColorText } from '../../common/integrate';
|
|
11
11
|
import { htmlTagRemove } from '../../../lib';
|
|
12
12
|
|
|
13
13
|
const Broadcast = (props: {
|
|
14
|
+
isMobileSize: boolean | null;
|
|
14
15
|
tab: string;
|
|
15
16
|
onMoreViewText: (str: string) => void;
|
|
16
17
|
onMoreView: () => void;
|
|
@@ -27,10 +28,44 @@ const Broadcast = (props: {
|
|
|
27
28
|
map: number;
|
|
28
29
|
};
|
|
29
30
|
}) => {
|
|
30
|
-
const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
|
|
31
|
+
const { tab, onMoreViewText, list, pages, onMoreView, search, isMobileSize, listCount } = props;
|
|
31
32
|
|
|
32
33
|
const [loading, setLoading] = useState<boolean>(false);
|
|
33
34
|
|
|
35
|
+
const [allTabPage, setAllTabPage] = useState<number>(0);
|
|
36
|
+
const [allTabList, setAllTabList] = useState<IBroadCastTypes[]>([]);
|
|
37
|
+
|
|
38
|
+
const getAllPage = () => {
|
|
39
|
+
const itemsToAdd = 4;
|
|
40
|
+
|
|
41
|
+
// broadcastList에서 잘라낼 시작 인덱스 계산
|
|
42
|
+
const startIndex = 2 + allTabPage * 4;
|
|
43
|
+
const endIndex = startIndex + itemsToAdd;
|
|
44
|
+
const newItems = list.broadcastList.slice(startIndex, endIndex);
|
|
45
|
+
const updatedList = [...allTabList, ...newItems];
|
|
46
|
+
setAllTabList(updatedList);
|
|
47
|
+
|
|
48
|
+
// 다음 호출 후 예상 총 개수
|
|
49
|
+
const nextTotalCount = updatedList.length + itemsToAdd;
|
|
50
|
+
// 현재 broadcastList의 길이
|
|
51
|
+
const currentListLength = list.broadcastList.length;
|
|
52
|
+
|
|
53
|
+
// 다음 총 개수가 broadcastList 길이를 초과하면 api 호출
|
|
54
|
+
// 예: broadcastList가 24일 때, 22 -> 26이 되면 호출
|
|
55
|
+
if (nextTotalCount > currentListLength) {
|
|
56
|
+
onMoreView();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 페이지 상태 증가
|
|
60
|
+
setAllTabPage(allTabPage + 1);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (allTabList.length === 0) {
|
|
65
|
+
setAllTabList(list.broadcastList.slice(0, 2));
|
|
66
|
+
}
|
|
67
|
+
}, [list.broadcastList]);
|
|
68
|
+
|
|
34
69
|
return (
|
|
35
70
|
<>
|
|
36
71
|
{tab === '전체' || tab === 'broadcast' ? (
|
|
@@ -47,161 +82,157 @@ const Broadcast = (props: {
|
|
|
47
82
|
onClick={str => onMoreViewText(str)}
|
|
48
83
|
count={listCount.broadcast}
|
|
49
84
|
/>
|
|
50
|
-
|
|
51
85
|
<div
|
|
52
86
|
className={
|
|
53
87
|
'm-auto grid w-full grid-cols-2 gap-10 max-lg:flex max-lg:flex-col max-lg:gap-0'
|
|
54
88
|
}
|
|
55
89
|
>
|
|
56
|
-
{(tab === '전체'
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
90
|
+
{(tab === '전체'
|
|
91
|
+
? isMobileSize === true
|
|
92
|
+
? allTabList
|
|
93
|
+
: list.broadcastList.slice(0, 4)
|
|
94
|
+
: list.broadcastList
|
|
95
|
+
).map((item, index: number) => {
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
key={'broadcast' + item.id}
|
|
99
|
+
className={'w-full lg:flex lg:flex-row lg:flex-wrap lg:justify-between'}
|
|
100
|
+
>
|
|
101
|
+
{/*mobile*/}
|
|
102
|
+
<Link
|
|
103
|
+
href={{
|
|
104
|
+
pathname: '/broadcast/' + item.id
|
|
105
|
+
}}
|
|
61
106
|
className={
|
|
62
|
-
'
|
|
107
|
+
'mx-auto flex flex-col items-center justify-center lg:hidden' +
|
|
108
|
+
(tab === '전체' && index === 3
|
|
109
|
+
? ''
|
|
110
|
+
: ' mb-10 max-sm:mb-5 sm:mt-8 ')
|
|
63
111
|
}
|
|
64
112
|
>
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
113
|
+
<div className={'flex w-[100%] items-center justify-center'}>
|
|
114
|
+
<Image
|
|
115
|
+
// src={imagePath + item.img}
|
|
116
|
+
src={'https://d1tgonli21s4df.cloudfront.net' + item.img}
|
|
117
|
+
alt={item.alt}
|
|
118
|
+
width={400}
|
|
119
|
+
height={508}
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
<div
|
|
70
123
|
className={
|
|
71
|
-
'
|
|
72
|
-
(tab === '전체' && index === 3
|
|
73
|
-
? ''
|
|
74
|
-
: ' mb-10 max-sm:mb-5 sm:mt-8 ')
|
|
124
|
+
'mt-4 flex w-[100%] flex-row items-center gap-4 leading-none sm:flex '
|
|
75
125
|
}
|
|
76
126
|
>
|
|
77
|
-
<div className={'flex w-[100%] items-center justify-center'}>
|
|
78
|
-
<Image
|
|
79
|
-
// src={imagePath + item.img}
|
|
80
|
-
src={'https://d1tgonli21s4df.cloudfront.net' + item.img}
|
|
81
|
-
alt={item.alt}
|
|
82
|
-
width={400}
|
|
83
|
-
height={508}
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
127
|
<div
|
|
87
128
|
className={
|
|
88
|
-
'
|
|
129
|
+
'text-[18px] font-medium text-[#285EA7] lg:text-[19px]'
|
|
89
130
|
}
|
|
90
131
|
>
|
|
91
|
-
|
|
92
|
-
className={
|
|
93
|
-
'text-[18px] font-medium text-[#285EA7] lg:text-[19px]'
|
|
94
|
-
}
|
|
95
|
-
>
|
|
96
|
-
{item.broadcast}
|
|
97
|
-
</div>
|
|
98
|
-
<div
|
|
99
|
-
className={
|
|
100
|
-
'text-[14px] text-[#666666] max-sm:pt-[1px] xs:text-[13px] sm:text-[14px] lg:text-[16px]'
|
|
101
|
-
}
|
|
102
|
-
>
|
|
103
|
-
{dayjs(item.timestamp).format('YYYY-MM-DD')}
|
|
104
|
-
</div>
|
|
132
|
+
{item.broadcast}
|
|
105
133
|
</div>
|
|
106
|
-
<p
|
|
107
|
-
className={
|
|
108
|
-
'my-4 w-[100%] break-keep text-left text-[18px] font-[800] xs:my-8 xs:text-[20px] sm:mb-6 sm:mt-8 sm:text-[22px]'
|
|
109
|
-
}
|
|
110
|
-
>
|
|
111
|
-
{searchColorText(item.title, search)}
|
|
112
|
-
</p>
|
|
113
134
|
<div
|
|
114
135
|
className={
|
|
115
|
-
'
|
|
136
|
+
'text-[14px] text-[#666666] max-sm:pt-[1px] xs:text-[13px] sm:text-[14px] lg:text-[16px]'
|
|
116
137
|
}
|
|
117
138
|
>
|
|
118
|
-
{
|
|
139
|
+
{dayjs(item.timestamp).format('YYYY-MM-DD')}
|
|
119
140
|
</div>
|
|
120
|
-
</
|
|
141
|
+
</div>
|
|
142
|
+
<p
|
|
143
|
+
className={
|
|
144
|
+
'my-4 w-[100%] break-keep text-left text-[18px] font-[800] xs:my-8 xs:text-[20px] sm:mb-6 sm:mt-8 sm:text-[22px]'
|
|
145
|
+
}
|
|
146
|
+
>
|
|
147
|
+
{searchColorText(item.title, search)}
|
|
148
|
+
</p>
|
|
149
|
+
<div
|
|
150
|
+
className={
|
|
151
|
+
'mb-6 line-clamp-2 w-[100%] overflow-hidden text-ellipsis text-[#666666] sm:line-clamp-5'
|
|
152
|
+
}
|
|
153
|
+
>
|
|
154
|
+
{htmlTagRemove(item.summary)}
|
|
155
|
+
</div>
|
|
156
|
+
</Link>
|
|
121
157
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
158
|
+
{/*웹환경*/}
|
|
159
|
+
<Link
|
|
160
|
+
href={{
|
|
161
|
+
pathname: '/broadcast/' + item.id
|
|
162
|
+
}}
|
|
163
|
+
className={
|
|
164
|
+
'h-[250px] w-full items-center justify-center max-lg:hidden lg:flex lg:flex-col '
|
|
165
|
+
}
|
|
166
|
+
key={item.id}
|
|
167
|
+
>
|
|
168
|
+
<div
|
|
127
169
|
className={
|
|
128
|
-
'
|
|
170
|
+
'my-4 flex w-full flex-row items-center justify-start gap-4'
|
|
129
171
|
}
|
|
130
|
-
key={item.id}
|
|
131
172
|
>
|
|
132
173
|
<div
|
|
133
174
|
className={
|
|
134
|
-
'
|
|
175
|
+
'text-[14px] font-medium text-[#285EA7] lg:text-[19px]'
|
|
135
176
|
}
|
|
136
177
|
>
|
|
137
|
-
|
|
178
|
+
{item.broadcast}
|
|
179
|
+
</div>
|
|
180
|
+
<data className={'text-[14px] text-[#666666] lg:text-[16px]'}>
|
|
181
|
+
{dayjs(item.timestamp).format('YYYY-MM-DD')}
|
|
182
|
+
</data>
|
|
183
|
+
</div>
|
|
184
|
+
<div
|
|
185
|
+
className={'relative flex w-full items-center justify-between'}
|
|
186
|
+
>
|
|
187
|
+
<div className={'flex h-full w-[36%] max-xl:w-[50%]'}>
|
|
188
|
+
<span
|
|
138
189
|
className={
|
|
139
|
-
'
|
|
190
|
+
'relative flex h-[189px] w-full items-center justify-center overflow-hidden '
|
|
140
191
|
}
|
|
141
192
|
>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
193
|
+
<Image
|
|
194
|
+
// src={imagePath + item.img}
|
|
195
|
+
src={
|
|
196
|
+
'https://d1tgonli21s4df.cloudfront.net' +
|
|
197
|
+
item.img
|
|
198
|
+
}
|
|
199
|
+
alt={item.alt}
|
|
200
|
+
className={'object-contain'}
|
|
201
|
+
fill
|
|
202
|
+
sizes="256px"
|
|
203
|
+
/>
|
|
204
|
+
</span>
|
|
149
205
|
</div>
|
|
150
206
|
<div
|
|
151
207
|
className={
|
|
152
|
-
'
|
|
208
|
+
'flex h-full w-[60%] flex-col justify-center overflow-hidden max-xl:w-[46%]'
|
|
153
209
|
}
|
|
154
210
|
>
|
|
155
|
-
<div
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<Image
|
|
162
|
-
// src={imagePath + item.img}
|
|
163
|
-
src={
|
|
164
|
-
'https://d1tgonli21s4df.cloudfront.net' +
|
|
165
|
-
item.img
|
|
166
|
-
}
|
|
167
|
-
alt={item.alt}
|
|
168
|
-
className={'object-contain'}
|
|
169
|
-
fill
|
|
170
|
-
sizes="256px"
|
|
171
|
-
/>
|
|
172
|
-
</span>
|
|
211
|
+
<div
|
|
212
|
+
className={
|
|
213
|
+
'line-clamp-3 w-full text-left text-[18px] font-semibold lg:text-[19px] xl:text-[22px] xxl:text-[24px] '
|
|
214
|
+
}
|
|
215
|
+
>
|
|
216
|
+
{searchColorText(item.title, search)}
|
|
173
217
|
</div>
|
|
174
218
|
<div
|
|
175
219
|
className={
|
|
176
|
-
'
|
|
220
|
+
'line-clamp-3 w-full overflow-hidden text-ellipsis py-3 text-[#666666] lg:text-[14px] xl:text-[16px]'
|
|
177
221
|
}
|
|
178
222
|
>
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
'
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
</div>
|
|
186
|
-
<div
|
|
187
|
-
className={
|
|
188
|
-
'line-clamp-3 w-full overflow-hidden text-ellipsis py-3 text-[#666666] lg:text-[14px] xl:text-[16px]'
|
|
189
|
-
}
|
|
190
|
-
>
|
|
191
|
-
<span className={'line-clamp-3'}>
|
|
192
|
-
{htmlTagRemove(item.summary).replaceAll(
|
|
193
|
-
' ',
|
|
194
|
-
' '
|
|
195
|
-
)}
|
|
196
|
-
</span>
|
|
197
|
-
</div>
|
|
223
|
+
<span className={'line-clamp-3'}>
|
|
224
|
+
{htmlTagRemove(item.summary).replaceAll(
|
|
225
|
+
' ',
|
|
226
|
+
' '
|
|
227
|
+
)}
|
|
228
|
+
</span>
|
|
198
229
|
</div>
|
|
199
230
|
</div>
|
|
200
|
-
</
|
|
201
|
-
</
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
)}
|
|
231
|
+
</div>
|
|
232
|
+
</Link>
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
})}
|
|
205
236
|
</div>
|
|
206
237
|
{tab != '전체' && (
|
|
207
238
|
<ViewMore
|
|
@@ -216,6 +247,14 @@ const Broadcast = (props: {
|
|
|
216
247
|
}}
|
|
217
248
|
/>
|
|
218
249
|
)}
|
|
250
|
+
{tab === '전체' && isMobileSize === true && (
|
|
251
|
+
<ViewMore
|
|
252
|
+
flag={allTabList.length != listCount.broadcast}
|
|
253
|
+
func={() => {
|
|
254
|
+
getAllPage();
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
)}
|
|
219
258
|
</div>
|
|
220
259
|
) : (
|
|
221
260
|
<></>
|
|
@@ -1,37 +1,61 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import Link from 'next/link';
|
|
3
3
|
import { NoResult } from './NoResult';
|
|
4
|
-
import uuid from 'react-uuid';
|
|
5
4
|
import { ViewMore } from './ViewMore';
|
|
6
5
|
import { Title } from './Title';
|
|
7
6
|
import { searchColorText } from '../../common/integrate';
|
|
8
7
|
const Field = (props) => {
|
|
9
|
-
const { tab, onMoreViewText, list, pages, search, onMoreView, listCount } = props;
|
|
8
|
+
const { tab, onMoreViewText, list, pages, isMobileSize, search, onMoreView, listCount } = props;
|
|
10
9
|
const [loading, setLoading] = useState(false);
|
|
10
|
+
const [allTabPage, setAllTabPage] = useState(0);
|
|
11
|
+
const [allTabList, setAllTabList] = useState([]);
|
|
12
|
+
const getAllPage = () => {
|
|
13
|
+
const itemsToAdd = 10;
|
|
14
|
+
const startIndex = 10 + allTabPage * 10;
|
|
15
|
+
const endIndex = startIndex + itemsToAdd;
|
|
16
|
+
const newItems = list.fieldList.slice(startIndex, endIndex);
|
|
17
|
+
const updatedList = [...allTabList, ...newItems];
|
|
18
|
+
setAllTabList(updatedList);
|
|
19
|
+
const nextTotalCount = updatedList.length + itemsToAdd;
|
|
20
|
+
const currentListLength = list.fieldList.length;
|
|
21
|
+
if (nextTotalCount > currentListLength) {
|
|
22
|
+
onMoreView();
|
|
23
|
+
}
|
|
24
|
+
// 페이지 상태 증가
|
|
25
|
+
setAllTabPage(allTabPage + 1);
|
|
26
|
+
};
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (allTabList.length === 0) {
|
|
29
|
+
setAllTabList(list.fieldList.slice(0, 10));
|
|
30
|
+
}
|
|
31
|
+
}, [list.fieldList]);
|
|
11
32
|
return (<>
|
|
12
33
|
{tab === '전체' || tab === 'field' ? (tab === 'field' && listCount.field < 1 ? (<NoResult />) : (<>
|
|
13
34
|
{listCount.field > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
|
|
14
35
|
<Title title={'업무분야'} tab={tab} type={'field'} onClick={str => onMoreViewText(str)} count={listCount.field}/>
|
|
15
|
-
|
|
16
36
|
<div className={'my-4 grid gap-[16px] sm:m-2 sm:grid-cols-2 lg:grid-cols-3'}>
|
|
17
|
-
{(tab === '전체'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
37
|
+
{(tab === '전체'
|
|
38
|
+
? isMobileSize === true
|
|
39
|
+
? allTabList
|
|
40
|
+
: list.fieldList.slice(0, 6)
|
|
41
|
+
: list.fieldList).map((item, index) => {
|
|
42
|
+
return (<Link href={`${item.pathname}field_new/[idx]`} target={item.center_code === props.center_code ? '' : '_blank'} as={`${item.pathname}field_new/${item.idx}`} key={`${item.pathname}field_new/[idx]`}>
|
|
43
|
+
<p className={'text-[20px] text-[#555555] max-xl:text-[18px] max-sm:text-[16px] max-xs:text-[15px]'}>
|
|
44
|
+
<span className={'mr-2 text-[#99999]'}>•</span>
|
|
45
|
+
업무분야
|
|
46
|
+
<span className={'mx-4 inline-block font-semibold'}> > </span>
|
|
47
|
+
{searchColorText(item.title, search)}
|
|
48
|
+
</p>
|
|
49
|
+
</Link>);
|
|
29
50
|
})}
|
|
30
51
|
</div>
|
|
31
52
|
{tab != '전체' && (<ViewMore flag={list.fieldList.length != listCount.field} loading={loading} totalPage={Math.ceil(listCount.field / 50)} nowPage={pages.fieldList} func={() => {
|
|
32
53
|
setLoading(true);
|
|
33
54
|
onMoreView();
|
|
34
55
|
setLoading(false);
|
|
56
|
+
}}/>)}
|
|
57
|
+
{tab === '전체' && isMobileSize === true && (<ViewMore flag={allTabList.length != listCount.field} func={() => {
|
|
58
|
+
getAllPage();
|
|
35
59
|
}}/>)}
|
|
36
60
|
</div>) : (<></>)}
|
|
37
61
|
</>)) : null}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import Link from 'next/link';
|
|
3
3
|
import { NoResult } from './NoResult';
|
|
4
|
-
import
|
|
5
|
-
import { IListPagesType, IListTypes } from './integrateType';
|
|
6
|
-
|
|
4
|
+
import { IFieldTypes, IListPagesType, IListTypes } from './integrateType';
|
|
7
5
|
import { ViewMore } from './ViewMore';
|
|
8
6
|
import { Title } from './Title';
|
|
9
|
-
import { useTranslation } from 'next-i18next';
|
|
10
7
|
import { searchColorText } from '../../common/integrate';
|
|
8
|
+
|
|
11
9
|
const Field = (props: {
|
|
10
|
+
isMobileSize: boolean | null;
|
|
12
11
|
tab: string;
|
|
13
12
|
onMoreViewText: (str: string) => void;
|
|
14
13
|
onMoreView: () => void;
|
|
@@ -26,9 +25,37 @@ const Field = (props: {
|
|
|
26
25
|
map: number;
|
|
27
26
|
};
|
|
28
27
|
}) => {
|
|
29
|
-
const { tab, onMoreViewText, list, pages, search, onMoreView, listCount } = props;
|
|
28
|
+
const { tab, onMoreViewText, list, pages, isMobileSize, search, onMoreView, listCount } = props;
|
|
30
29
|
|
|
31
30
|
const [loading, setLoading] = useState<boolean>(false);
|
|
31
|
+
const [allTabPage, setAllTabPage] = useState<number>(0);
|
|
32
|
+
const [allTabList, setAllTabList] = useState<IFieldTypes[]>([]);
|
|
33
|
+
|
|
34
|
+
const getAllPage = () => {
|
|
35
|
+
const itemsToAdd = 10;
|
|
36
|
+
|
|
37
|
+
const startIndex = 10 + allTabPage * 10;
|
|
38
|
+
const endIndex = startIndex + itemsToAdd;
|
|
39
|
+
const newItems = list.fieldList.slice(startIndex, endIndex);
|
|
40
|
+
const updatedList = [...allTabList, ...newItems];
|
|
41
|
+
setAllTabList(updatedList);
|
|
42
|
+
|
|
43
|
+
const nextTotalCount = updatedList.length + itemsToAdd;
|
|
44
|
+
const currentListLength = list.fieldList.length;
|
|
45
|
+
|
|
46
|
+
if (nextTotalCount > currentListLength) {
|
|
47
|
+
onMoreView();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 페이지 상태 증가
|
|
51
|
+
setAllTabPage(allTabPage + 1);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (allTabList.length === 0) {
|
|
56
|
+
setAllTabList(list.fieldList.slice(0, 10));
|
|
57
|
+
}
|
|
58
|
+
}, [list.fieldList]);
|
|
32
59
|
|
|
33
60
|
return (
|
|
34
61
|
<>
|
|
@@ -46,34 +73,33 @@ const Field = (props: {
|
|
|
46
73
|
onClick={str => onMoreViewText(str)}
|
|
47
74
|
count={listCount.field}
|
|
48
75
|
/>
|
|
49
|
-
|
|
50
76
|
<div className={'my-4 grid gap-[16px] sm:m-2 sm:grid-cols-2 lg:grid-cols-3'}>
|
|
51
|
-
{(tab === '전체'
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
{(tab === '전체'
|
|
78
|
+
? isMobileSize === true
|
|
79
|
+
? allTabList
|
|
80
|
+
: list.fieldList.slice(0, 6)
|
|
81
|
+
: list.fieldList
|
|
82
|
+
).map((item, index) => {
|
|
83
|
+
return (
|
|
84
|
+
<Link
|
|
85
|
+
href={`${item.pathname}field_new/[idx]`}
|
|
86
|
+
target={item.center_code === props.center_code ? '' : '_blank'}
|
|
87
|
+
as={`${item.pathname}field_new/${item.idx}`}
|
|
88
|
+
key={`${item.pathname}field_new/[idx]`}
|
|
89
|
+
>
|
|
90
|
+
<p
|
|
91
|
+
className={
|
|
92
|
+
'text-[20px] text-[#555555] max-xl:text-[18px] max-sm:text-[16px] max-xs:text-[15px]'
|
|
93
|
+
}
|
|
59
94
|
>
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{' '}
|
|
69
|
-
>{' '}
|
|
70
|
-
</span>
|
|
71
|
-
{searchColorText(item.title, search)}
|
|
72
|
-
</p>
|
|
73
|
-
</Link>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
)}
|
|
95
|
+
<span className={'mr-2 text-[#99999]'}>•</span>
|
|
96
|
+
업무분야
|
|
97
|
+
<span className={'mx-4 inline-block font-semibold'}> > </span>
|
|
98
|
+
{searchColorText(item.title, search)}
|
|
99
|
+
</p>
|
|
100
|
+
</Link>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
77
103
|
</div>
|
|
78
104
|
{tab != '전체' && (
|
|
79
105
|
<ViewMore
|
|
@@ -88,6 +114,14 @@ const Field = (props: {
|
|
|
88
114
|
}}
|
|
89
115
|
/>
|
|
90
116
|
)}
|
|
117
|
+
{tab === '전체' && isMobileSize === true && (
|
|
118
|
+
<ViewMore
|
|
119
|
+
flag={allTabList.length != listCount.field}
|
|
120
|
+
func={() => {
|
|
121
|
+
getAllPage();
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
91
125
|
</div>
|
|
92
126
|
) : (
|
|
93
127
|
<></>
|