@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,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 { NoResult } from './NoResult';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
@@ -6,47 +6,80 @@ import { Title } from './Title';
|
|
|
6
6
|
import { ViewMore } from './ViewMore';
|
|
7
7
|
import { searchColorText } from '../../common/integrate';
|
|
8
8
|
const Reply = (props) => {
|
|
9
|
-
const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
|
|
9
|
+
const { tab, onMoreViewText, list, pages, isMobileSize, onMoreView, search, 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
|
+
// replyList에서 잘라낼 시작 인덱스 계산
|
|
16
|
+
const startIndex = 2 + allTabPage * 4;
|
|
17
|
+
const endIndex = startIndex + itemsToAdd;
|
|
18
|
+
const newItems = list.replyList.slice(startIndex, endIndex);
|
|
19
|
+
const updatedList = [...allTabList, ...newItems];
|
|
20
|
+
setAllTabList(updatedList);
|
|
21
|
+
// 다음 호출 후 예상 총 개수
|
|
22
|
+
const nextTotalCount = updatedList.length + itemsToAdd;
|
|
23
|
+
// 현재 replyList의 길이
|
|
24
|
+
const currentListLength = list.replyList.length;
|
|
25
|
+
// 다음 총 개수가 replyList 길이를 초과하면 api 호출
|
|
26
|
+
// 예: replyList가 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.replyList.slice(0, 2));
|
|
36
|
+
}
|
|
37
|
+
}, [list.replyList]);
|
|
11
38
|
return (<>
|
|
12
39
|
{tab === '전체' || tab === 'reply' ? (tab === 'reply' && listCount.reply < 1 ? (<NoResult />) : (<>
|
|
13
40
|
{listCount.reply > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
|
|
14
41
|
<Title title={'고객후기'} tab={tab} type={'reply'} onClick={str => onMoreViewText(str)} count={listCount.reply}/>
|
|
15
|
-
|
|
16
42
|
<div className={'mb-9 mt-8 grid gap-[18px] sm:grid-cols-2'}>
|
|
17
|
-
{(tab === '전체'
|
|
18
|
-
|
|
19
|
-
|
|
43
|
+
{(tab === '전체'
|
|
44
|
+
? isMobileSize === true
|
|
45
|
+
? allTabList
|
|
46
|
+
: list.replyList.slice(0, 4)
|
|
47
|
+
: list.replyList).map((item, index) => {
|
|
48
|
+
return (<div key={'reply' + item.id} className={'h-[280px] border-[5px] border-solid border-[#EAEAEA] p-7 max-xs:h-[190px] max-xs:p-4 sm:p-8 '}>
|
|
49
|
+
<Link href={(item.crime_code != props.crime_code
|
|
20
50
|
? 'https://www.daeryunlaw.com'
|
|
21
51
|
: '') +
|
|
22
52
|
'/reply/' +
|
|
23
53
|
item.id} target={item.crime_code === props.crime_code ? '' : '_blank'}>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
54
|
+
<div className={'flex flex-col'}>
|
|
55
|
+
<p className={'h-[70px] text-[20px] font-[800] max-xs:h-[60px] max-xs:text-[18px] sm:text-[22px]'}>
|
|
56
|
+
<span className={'text-[#285FA7]'}>{item.etc4} </span>
|
|
57
|
+
<br className={'block sm:hidden'}/>
|
|
58
|
+
{item.etc5}
|
|
59
|
+
</p>
|
|
60
|
+
<p className={'mb-[20px] mt-[10px] line-clamp-2 h-[50px] text-[18px] text-[#555555] max-sm:mb-[40px] max-sm:mt-[20px] max-sm:text-[16px] max-xs:mb-0 max-xs:mt-[5px] max-xs:h-[40px] max-xs:text-[15px]'}>
|
|
61
|
+
{searchColorText(item.summary
|
|
32
62
|
.replaceAll(/<(\/)?[a-zA-Z0-9]*(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi, '')
|
|
33
63
|
.replaceAll(' ', ' '), search)}
|
|
64
|
+
</p>
|
|
65
|
+
<div className={'mt-6 flex items-center text-[#666666] sm:mt-8'}>
|
|
66
|
+
<p className={'w-[20%] text-[17px] max-xl:w-[35%] max-md:w-[50%] max-sm:w-[30%] max-sm:text-[15px]'}>
|
|
67
|
+
{dayjs(item.timestamp).format('YYYY.MM.DD')}
|
|
34
68
|
</p>
|
|
35
|
-
<div className={'
|
|
36
|
-
<p className={'w-[20%] text-[17px] max-xl:w-[35%] max-md:w-[50%] max-sm:w-[30%] max-sm:text-[15px]'}>
|
|
37
|
-
{dayjs(item.timestamp).format('YYYY.MM.DD')}
|
|
38
|
-
</p>
|
|
39
|
-
<div className={'h-[2px] w-[80%] bg-[#D8D8D8] max-xl:w-[65%] max-md:w-[50%] max-sm:w-[70%]'}></div>
|
|
40
|
-
</div>
|
|
69
|
+
<div className={'h-[2px] w-[80%] bg-[#D8D8D8] max-xl:w-[65%] max-md:w-[50%] max-sm:w-[70%]'}></div>
|
|
41
70
|
</div>
|
|
42
|
-
</
|
|
43
|
-
</
|
|
71
|
+
</div>
|
|
72
|
+
</Link>
|
|
73
|
+
</div>);
|
|
44
74
|
})}
|
|
45
75
|
</div>
|
|
46
76
|
{tab != '전체' && (<ViewMore flag={list.replyList.length != listCount.reply} loading={loading} totalPage={Math.ceil(listCount.reply / 12)} nowPage={pages.replyList} func={() => {
|
|
47
77
|
setLoading(true);
|
|
48
78
|
onMoreView();
|
|
49
79
|
setLoading(false);
|
|
80
|
+
}}/>)}{' '}
|
|
81
|
+
{tab === '전체' && isMobileSize === true && (<ViewMore loading={loading} flag={allTabList.length != listCount.reply} func={() => {
|
|
82
|
+
getAllPage();
|
|
50
83
|
}}/>)}
|
|
51
84
|
</div>) : (<></>)}
|
|
52
85
|
</>)) : null}
|
|
@@ -3,13 +3,14 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import { NoResult } from './NoResult';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
|
-
import { IListPagesType, IListTypes } from './integrateType';
|
|
6
|
+
import { IListPagesType, IListTypes, IReplyTypes } from './integrateType';
|
|
7
7
|
import { Title } from './Title';
|
|
8
8
|
import { ViewMore } from './ViewMore';
|
|
9
9
|
import { useTranslation } from 'next-i18next';
|
|
10
10
|
import { searchColorText } from '../../common/integrate';
|
|
11
11
|
|
|
12
12
|
const Reply = (props: {
|
|
13
|
+
isMobileSize: boolean | null;
|
|
13
14
|
tab: string;
|
|
14
15
|
onMoreViewText: (str: string) => void;
|
|
15
16
|
onMoreView: () => void;
|
|
@@ -27,10 +28,42 @@ const Reply = (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, isMobileSize, onMoreView, search, listCount } = props;
|
|
31
32
|
|
|
32
33
|
const [loading, setLoading] = useState<boolean>(false);
|
|
34
|
+
const [allTabPage, setAllTabPage] = useState<number>(0);
|
|
35
|
+
const [allTabList, setAllTabList] = useState<IReplyTypes[]>([]);
|
|
33
36
|
|
|
37
|
+
const getAllPage = () => {
|
|
38
|
+
const itemsToAdd = 4;
|
|
39
|
+
|
|
40
|
+
// replyList에서 잘라낼 시작 인덱스 계산
|
|
41
|
+
const startIndex = 2 + allTabPage * 4;
|
|
42
|
+
const endIndex = startIndex + itemsToAdd;
|
|
43
|
+
const newItems = list.replyList.slice(startIndex, endIndex);
|
|
44
|
+
const updatedList = [...allTabList, ...newItems];
|
|
45
|
+
setAllTabList(updatedList);
|
|
46
|
+
|
|
47
|
+
// 다음 호출 후 예상 총 개수
|
|
48
|
+
const nextTotalCount = updatedList.length + itemsToAdd;
|
|
49
|
+
// 현재 replyList의 길이
|
|
50
|
+
const currentListLength = list.replyList.length;
|
|
51
|
+
|
|
52
|
+
// 다음 총 개수가 replyList 길이를 초과하면 api 호출
|
|
53
|
+
// 예: replyList가 24일 때, 22 -> 26이 되면 호출
|
|
54
|
+
if (nextTotalCount > currentListLength) {
|
|
55
|
+
onMoreView();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 페이지 상태 증가
|
|
59
|
+
setAllTabPage(allTabPage + 1);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (allTabList.length === 0) {
|
|
64
|
+
setAllTabList(list.replyList.slice(0, 2));
|
|
65
|
+
}
|
|
66
|
+
}, [list.replyList]);
|
|
34
67
|
return (
|
|
35
68
|
<>
|
|
36
69
|
{tab === '전체' || tab === 'reply' ? (
|
|
@@ -47,76 +80,76 @@ const Reply = (props: {
|
|
|
47
80
|
onClick={str => onMoreViewText(str)}
|
|
48
81
|
count={listCount.reply}
|
|
49
82
|
/>
|
|
50
|
-
|
|
51
83
|
<div className={'mb-9 mt-8 grid gap-[18px] sm:grid-cols-2'}>
|
|
52
|
-
{(tab === '전체'
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
{(tab === '전체'
|
|
85
|
+
? isMobileSize === true
|
|
86
|
+
? allTabList
|
|
87
|
+
: list.replyList.slice(0, 4)
|
|
88
|
+
: list.replyList
|
|
89
|
+
).map((item, index) => {
|
|
90
|
+
return (
|
|
91
|
+
<div
|
|
92
|
+
key={'reply' + item.id}
|
|
93
|
+
className={
|
|
94
|
+
'h-[280px] border-[5px] border-solid border-[#EAEAEA] p-7 max-xs:h-[190px] max-xs:p-4 sm:p-8 '
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<Link
|
|
98
|
+
href={
|
|
99
|
+
(item.crime_code != props.crime_code
|
|
100
|
+
? 'https://www.daeryunlaw.com'
|
|
101
|
+
: '') +
|
|
102
|
+
'/reply/' +
|
|
103
|
+
item.id
|
|
59
104
|
}
|
|
105
|
+
target={item.crime_code === props.crime_code ? '' : '_blank'}
|
|
60
106
|
>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
item.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
107
|
+
<div className={'flex flex-col'}>
|
|
108
|
+
<p
|
|
109
|
+
className={
|
|
110
|
+
'h-[70px] text-[20px] font-[800] max-xs:h-[60px] max-xs:text-[18px] sm:text-[22px]'
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
<span className={'text-[#285FA7]'}>{item.etc4} </span>
|
|
114
|
+
<br className={'block sm:hidden'} />
|
|
115
|
+
{item.etc5}
|
|
116
|
+
</p>
|
|
117
|
+
<p
|
|
118
|
+
className={
|
|
119
|
+
'mb-[20px] mt-[10px] line-clamp-2 h-[50px] text-[18px] text-[#555555] max-sm:mb-[40px] max-sm:mt-[20px] max-sm:text-[16px] max-xs:mb-0 max-xs:mt-[5px] max-xs:h-[40px] max-xs:text-[15px]'
|
|
120
|
+
}
|
|
121
|
+
>
|
|
122
|
+
{searchColorText(
|
|
123
|
+
item.summary
|
|
124
|
+
.replaceAll(
|
|
125
|
+
/<(\/)?[a-zA-Z0-9]*(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi,
|
|
126
|
+
''
|
|
127
|
+
)
|
|
128
|
+
.replaceAll(' ', ' '),
|
|
129
|
+
search
|
|
130
|
+
)}
|
|
131
|
+
</p>
|
|
132
|
+
<div
|
|
133
|
+
className={'mt-6 flex items-center text-[#666666] sm:mt-8'}
|
|
134
|
+
>
|
|
81
135
|
<p
|
|
82
136
|
className={
|
|
83
|
-
'
|
|
137
|
+
'w-[20%] text-[17px] max-xl:w-[35%] max-md:w-[50%] max-sm:w-[30%] max-sm:text-[15px]'
|
|
84
138
|
}
|
|
85
139
|
>
|
|
86
|
-
{
|
|
87
|
-
item.summary
|
|
88
|
-
.replaceAll(
|
|
89
|
-
/<(\/)?[a-zA-Z0-9]*(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi,
|
|
90
|
-
''
|
|
91
|
-
)
|
|
92
|
-
.replaceAll(' ', ' '),
|
|
93
|
-
search
|
|
94
|
-
)}
|
|
140
|
+
{dayjs(item.timestamp).format('YYYY.MM.DD')}
|
|
95
141
|
</p>
|
|
96
142
|
<div
|
|
97
143
|
className={
|
|
98
|
-
'
|
|
144
|
+
'h-[2px] w-[80%] bg-[#D8D8D8] max-xl:w-[65%] max-md:w-[50%] max-sm:w-[70%]'
|
|
99
145
|
}
|
|
100
|
-
>
|
|
101
|
-
<p
|
|
102
|
-
className={
|
|
103
|
-
'w-[20%] text-[17px] max-xl:w-[35%] max-md:w-[50%] max-sm:w-[30%] max-sm:text-[15px]'
|
|
104
|
-
}
|
|
105
|
-
>
|
|
106
|
-
{dayjs(item.timestamp).format('YYYY.MM.DD')}
|
|
107
|
-
</p>
|
|
108
|
-
<div
|
|
109
|
-
className={
|
|
110
|
-
'h-[2px] w-[80%] bg-[#D8D8D8] max-xl:w-[65%] max-md:w-[50%] max-sm:w-[70%]'
|
|
111
|
-
}
|
|
112
|
-
></div>
|
|
113
|
-
</div>
|
|
146
|
+
></div>
|
|
114
147
|
</div>
|
|
115
|
-
</
|
|
116
|
-
</
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
)}
|
|
148
|
+
</div>
|
|
149
|
+
</Link>
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
})}
|
|
120
153
|
</div>
|
|
121
154
|
{tab != '전체' && (
|
|
122
155
|
<ViewMore
|
|
@@ -130,6 +163,15 @@ const Reply = (props: {
|
|
|
130
163
|
setLoading(false);
|
|
131
164
|
}}
|
|
132
165
|
/>
|
|
166
|
+
)}{' '}
|
|
167
|
+
{tab === '전체' && isMobileSize === true && (
|
|
168
|
+
<ViewMore
|
|
169
|
+
loading={loading}
|
|
170
|
+
flag={allTabList.length != listCount.reply}
|
|
171
|
+
func={() => {
|
|
172
|
+
getAllPage();
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
133
175
|
)}
|
|
134
176
|
</div>
|
|
135
177
|
) : (
|
|
@@ -19,12 +19,15 @@ import Broadcast from './Broadcast';
|
|
|
19
19
|
import Reply from './Reply';
|
|
20
20
|
import Map from './Map';
|
|
21
21
|
import Lawyer from './Lawyer';
|
|
22
|
+
import useBrowser from '../../hook/useBrowser';
|
|
22
23
|
const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime_code }) => {
|
|
24
|
+
const { width } = useBrowser(true);
|
|
23
25
|
const router = useRouter();
|
|
24
26
|
const [tab, setTab] = useState('');
|
|
25
27
|
const [search, setSearch] = useState('');
|
|
26
28
|
const [list, setList] = useState(searchInit.list);
|
|
27
29
|
const [pages, setPages] = useState(searchInit.pages);
|
|
30
|
+
const [isMobileSize, setIsMobileSize] = useState(null);
|
|
28
31
|
const handleMoreView = (key, data) => {
|
|
29
32
|
// @ts-ignore
|
|
30
33
|
setPages(Object.assign(Object.assign({}, pages), { [key]: pages[key] + 1 }));
|
|
@@ -42,9 +45,20 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
|
|
|
42
45
|
setTab(String(router.query.tab));
|
|
43
46
|
// setPages(searchInit.pages)
|
|
44
47
|
}, [router.query]);
|
|
48
|
+
//브라우저 체크
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (width != 0 && width < 641 && isMobileSize != true) {
|
|
51
|
+
setIsMobileSize(true);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (width != 0 && width > 640 && isMobileSize != false) {
|
|
55
|
+
setIsMobileSize(false);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}, [width, isMobileSize]);
|
|
45
59
|
return (<span id={'integrate-result'}>
|
|
46
60
|
{tab === '전체' && totalCount < 1 ? (<NoResult />) : (<>
|
|
47
|
-
<Success center_code={center_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
61
|
+
<Success isMobileSize={isMobileSize} center_code={center_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
48
62
|
paramFetch('/api/integrate/list', {
|
|
49
63
|
page: pages.successList,
|
|
50
64
|
type: 'success',
|
|
@@ -56,7 +70,7 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
|
|
|
56
70
|
});
|
|
57
71
|
}} search={search} listCount={listCount}/>
|
|
58
72
|
|
|
59
|
-
<Reply crime_code={crime_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
73
|
+
<Reply isMobileSize={isMobileSize} crime_code={crime_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
60
74
|
paramFetch('/api/integrate/list', {
|
|
61
75
|
page: pages.replyList,
|
|
62
76
|
type: 'reply',
|
|
@@ -68,7 +82,7 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
|
|
|
68
82
|
});
|
|
69
83
|
}} listCount={listCount} search={search}/>
|
|
70
84
|
|
|
71
|
-
<LawInfo center_code={center_code} tab={tab} list={list} pages={pages} listCount={listCount} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
85
|
+
<LawInfo isMobileSize={isMobileSize} center_code={center_code} tab={tab} list={list} pages={pages} listCount={listCount} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
72
86
|
paramFetch('/api/integrate/list', {
|
|
73
87
|
page: pages.infoList,
|
|
74
88
|
type: 'info',
|
|
@@ -80,7 +94,7 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
|
|
|
80
94
|
});
|
|
81
95
|
}} search={search}/>
|
|
82
96
|
|
|
83
|
-
<Lawyer tab={tab} listCount={listCount} list={list} pages={pages} center_code={center_code} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
97
|
+
<Lawyer isMobileSize={isMobileSize} tab={tab} listCount={listCount} list={list} pages={pages} center_code={center_code} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
84
98
|
paramFetch(`api/integrate/list`, {
|
|
85
99
|
page: pages.lawyerList,
|
|
86
100
|
type: 'lawyer',
|
|
@@ -92,7 +106,7 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
|
|
|
92
106
|
});
|
|
93
107
|
}}/>
|
|
94
108
|
|
|
95
|
-
<Broadcast listCount={listCount} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
109
|
+
<Broadcast isMobileSize={isMobileSize} listCount={listCount} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
96
110
|
paramFetch('/api/integrate/list', {
|
|
97
111
|
page: pages.broadcastList,
|
|
98
112
|
type: 'broadcast',
|
|
@@ -104,7 +118,7 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
|
|
|
104
118
|
});
|
|
105
119
|
}} search={search}/>
|
|
106
120
|
|
|
107
|
-
<Field listCount={listCount} center_code={center_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
121
|
+
<Field isMobileSize={isMobileSize} listCount={listCount} center_code={center_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
108
122
|
paramFetch(`/api/integrate/list`, {
|
|
109
123
|
page: pages.fieldList,
|
|
110
124
|
type: 'field',
|
|
@@ -116,7 +130,7 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
|
|
|
116
130
|
});
|
|
117
131
|
}} search={search}/>
|
|
118
132
|
|
|
119
|
-
<Map listCount={listCount} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} search={search} onMoreView={() => {
|
|
133
|
+
<Map isMobileSize={isMobileSize} listCount={listCount} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} search={search} onMoreView={() => {
|
|
120
134
|
paramFetch('/api/integrate/list', {
|
|
121
135
|
page: pages.mapList,
|
|
122
136
|
type: 'map',
|
|
@@ -11,6 +11,7 @@ import Broadcast from './Broadcast';
|
|
|
11
11
|
import Reply from './Reply';
|
|
12
12
|
import Map from './Map';
|
|
13
13
|
import Lawyer from './Lawyer';
|
|
14
|
+
import useBrowser from '../../hook/useBrowser';
|
|
14
15
|
|
|
15
16
|
const SearchData = ({
|
|
16
17
|
list: propsList,
|
|
@@ -33,11 +34,13 @@ const SearchData = ({
|
|
|
33
34
|
map: number;
|
|
34
35
|
};
|
|
35
36
|
}) => {
|
|
37
|
+
const { width } = useBrowser(true);
|
|
36
38
|
const router = useRouter();
|
|
37
39
|
const [tab, setTab] = useState<string>('');
|
|
38
40
|
const [search, setSearch] = useState<string>('');
|
|
39
41
|
const [list, setList] = useState<IListTypes>(searchInit.list);
|
|
40
42
|
const [pages, setPages] = useState<IListPagesType>(searchInit.pages);
|
|
43
|
+
const [isMobileSize, setIsMobileSize] = useState<boolean | null>(null);
|
|
41
44
|
|
|
42
45
|
const handleMoreView = (key: string, data: any[]) => {
|
|
43
46
|
// @ts-ignore
|
|
@@ -60,6 +63,18 @@ const SearchData = ({
|
|
|
60
63
|
// setPages(searchInit.pages)
|
|
61
64
|
}, [router.query]);
|
|
62
65
|
|
|
66
|
+
//브라우저 체크
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (width != 0 && width < 641 && isMobileSize != true) {
|
|
69
|
+
setIsMobileSize(true);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (width != 0 && width > 640 && isMobileSize != false) {
|
|
73
|
+
setIsMobileSize(false);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}, [width, isMobileSize]);
|
|
77
|
+
|
|
63
78
|
return (
|
|
64
79
|
<span id={'integrate-result'}>
|
|
65
80
|
{tab === '전체' && totalCount < 1 ? (
|
|
@@ -67,6 +82,7 @@ const SearchData = ({
|
|
|
67
82
|
) : (
|
|
68
83
|
<>
|
|
69
84
|
<Success
|
|
85
|
+
isMobileSize={isMobileSize}
|
|
70
86
|
center_code={center_code}
|
|
71
87
|
tab={tab}
|
|
72
88
|
list={list}
|
|
@@ -92,6 +108,7 @@ const SearchData = ({
|
|
|
92
108
|
/>
|
|
93
109
|
|
|
94
110
|
<Reply
|
|
111
|
+
isMobileSize={isMobileSize}
|
|
95
112
|
crime_code={crime_code}
|
|
96
113
|
tab={tab}
|
|
97
114
|
list={list}
|
|
@@ -117,6 +134,7 @@ const SearchData = ({
|
|
|
117
134
|
/>
|
|
118
135
|
|
|
119
136
|
<LawInfo
|
|
137
|
+
isMobileSize={isMobileSize}
|
|
120
138
|
center_code={center_code}
|
|
121
139
|
tab={tab}
|
|
122
140
|
list={list}
|
|
@@ -142,6 +160,7 @@ const SearchData = ({
|
|
|
142
160
|
/>
|
|
143
161
|
|
|
144
162
|
<Lawyer
|
|
163
|
+
isMobileSize={isMobileSize}
|
|
145
164
|
tab={tab}
|
|
146
165
|
listCount={listCount}
|
|
147
166
|
list={list}
|
|
@@ -166,6 +185,7 @@ const SearchData = ({
|
|
|
166
185
|
/>
|
|
167
186
|
|
|
168
187
|
<Broadcast
|
|
188
|
+
isMobileSize={isMobileSize}
|
|
169
189
|
listCount={listCount}
|
|
170
190
|
tab={tab}
|
|
171
191
|
list={list}
|
|
@@ -190,6 +210,7 @@ const SearchData = ({
|
|
|
190
210
|
/>
|
|
191
211
|
|
|
192
212
|
<Field
|
|
213
|
+
isMobileSize={isMobileSize}
|
|
193
214
|
listCount={listCount}
|
|
194
215
|
center_code={center_code}
|
|
195
216
|
tab={tab}
|
|
@@ -216,6 +237,7 @@ const SearchData = ({
|
|
|
216
237
|
/>
|
|
217
238
|
|
|
218
239
|
<Map
|
|
240
|
+
isMobileSize={isMobileSize}
|
|
219
241
|
listCount={listCount}
|
|
220
242
|
tab={tab}
|
|
221
243
|
list={list}
|
|
@@ -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 { NoResult } from './NoResult';
|
|
4
4
|
import { Title } from './Title';
|
|
@@ -6,52 +6,85 @@ import { ViewMore } from './ViewMore';
|
|
|
6
6
|
import { searchColorText } from '../../common/integrate';
|
|
7
7
|
const Success = (props) => {
|
|
8
8
|
var _a;
|
|
9
|
-
const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
|
|
9
|
+
const { tab, onMoreViewText, list, pages, onMoreView, search, listCount, isMobileSize } = 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
|
+
// successList에서 잘라낼 시작 인덱스 계산
|
|
16
|
+
const startIndex = 2 + allTabPage * 4;
|
|
17
|
+
const endIndex = startIndex + itemsToAdd;
|
|
18
|
+
const newItems = list.successList.slice(startIndex, endIndex);
|
|
19
|
+
const updatedList = [...allTabList, ...newItems];
|
|
20
|
+
setAllTabList(updatedList);
|
|
21
|
+
// 다음 호출 후 예상 총 개수
|
|
22
|
+
const nextTotalCount = updatedList.length + itemsToAdd;
|
|
23
|
+
// 현재 successList의 길이
|
|
24
|
+
const currentListLength = list.successList.length;
|
|
25
|
+
// 다음 총 개수가 successList 길이를 초과하면 api 호출
|
|
26
|
+
// 예: successList가 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.successList.slice(0, 2));
|
|
36
|
+
}
|
|
37
|
+
}, [list.successList]);
|
|
11
38
|
return (<>
|
|
12
39
|
{tab === '전체' || tab === 'success' ? (tab === 'success' && listCount.success < 1 ? (<NoResult />) : (<>
|
|
13
40
|
{listCount.success > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
|
|
14
41
|
<Title title={'업무사례'} tab={tab} type={'success'} onClick={str => onMoreViewText(str)} count={listCount.success}/>
|
|
15
|
-
|
|
16
42
|
{((_a = list.successList) === null || _a === void 0 ? void 0 : _a.length) !== 0 && (<div className={'mb-9 mt-9 grid gap-[30px] sm:grid-cols-2'}>
|
|
17
|
-
{(tab === '전체'
|
|
43
|
+
{(tab === '전체'
|
|
44
|
+
? isMobileSize === true
|
|
45
|
+
? allTabList
|
|
46
|
+
: list.successList.slice(0, 4)
|
|
47
|
+
: list.successList).map((item, index) => {
|
|
18
48
|
var _a, _b;
|
|
19
49
|
return (<Link href={!item.center_code.includes('OF')
|
|
20
50
|
? item.pathname + 'success_new/' + item.id
|
|
21
51
|
: `https://${item.office_pathname}/success_new/${item.id}`} target={item.center_code === props.center_code ? '' : '_blank'} className={' overflow-hidden border-[2px] border-solid border-[#ebebebcc]'} key={item.id + item.center_code}>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</p>
|
|
33
|
-
|
|
34
|
-
<data className={'mt-3 block text-[#666666] max-sm:hidden max-sm:text-[14px]'}>
|
|
35
|
-
{(_a = item.created_at) === null || _a === void 0 ? void 0 : _a.split('T')[0].replaceAll('-', '.')}
|
|
36
|
-
</data>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<p className={'mb-8 ml-1 text-[20px] max-xl:mb-4 max-lg:mb-2 max-lg:text-[18px] max-md:text-[15px] max-sm:mb-0 max-sm:text-[17px] sm:ml-4 '}>
|
|
40
|
-
{searchColorText(item.title, search)}
|
|
41
|
-
</p>
|
|
42
|
-
<p className={'mt-6 text-[#666666] max-sm:text-[14px] sm:hidden'}>
|
|
43
|
-
{(_b = item.created_at) === null || _b === void 0 ? void 0 : _b.split('T')[0].replaceAll('-', '.')}
|
|
52
|
+
<p className={`ml-8 inline-block w-auto max-w-[70%] bg-[#2960A7] p-2 px-7 text-center text-[18px] font-[800] text-[#fff] max-lg:text-[16px] max-sm:text-[15px] max-2xs:text-[14px]`}>
|
|
53
|
+
<span className={'line-clamp-1'}>{item.sub}</span>
|
|
54
|
+
</p>
|
|
55
|
+
<div className={'flex flex-col gap-4 p-8 max-sm:pt-6'}>
|
|
56
|
+
<div className={'block flex-col items-center gap-[10px] sm:flex sm:flex-row'}>
|
|
57
|
+
<div className={'max-sm:mb-4'}>
|
|
58
|
+
<p className={` mb-3 flex h-[35px] w-[100px] flex-col items-center justify-center overflow-hidden rounded-[30px] bg-[#F2F6FA] text-center text-[16px] font-[800] leading-[18px] text-[#285FA7] max-sm:hidden max-sm:text-[15px] max-2xs:text-[14px] sm:mb-0 sm:h-[80px] sm:w-[80px] sm:rounded-full`}>
|
|
59
|
+
<span className={'line-clamp-2 break-keep px-3 text-center'}>
|
|
60
|
+
{item.result}
|
|
61
|
+
</span>
|
|
44
62
|
</p>
|
|
63
|
+
|
|
64
|
+
<data className={'mt-3 block text-[#666666] max-sm:hidden max-sm:text-[14px]'}>
|
|
65
|
+
{(_a = item.created_at) === null || _a === void 0 ? void 0 : _a.split('T')[0].replaceAll('-', '.')}
|
|
66
|
+
</data>
|
|
45
67
|
</div>
|
|
68
|
+
|
|
69
|
+
<p className={'mb-8 ml-1 text-[20px] max-xl:mb-4 max-lg:mb-2 max-lg:text-[18px] max-md:text-[15px] max-sm:mb-0 max-sm:text-[17px] sm:ml-4 '}>
|
|
70
|
+
{searchColorText(item.title, search)}
|
|
71
|
+
</p>
|
|
72
|
+
<p className={'mt-6 text-[#666666] max-sm:text-[14px] sm:hidden'}>
|
|
73
|
+
{(_b = item.created_at) === null || _b === void 0 ? void 0 : _b.split('T')[0].replaceAll('-', '.')}
|
|
74
|
+
</p>
|
|
46
75
|
</div>
|
|
47
|
-
</
|
|
76
|
+
</div>
|
|
77
|
+
</Link>);
|
|
48
78
|
})}
|
|
49
79
|
</div>)}
|
|
50
80
|
{tab != '전체' && (<ViewMore flag={list.successList.length != listCount.success} loading={loading} totalPage={Math.ceil(listCount.success / 12)} nowPage={pages.successList} func={() => {
|
|
51
81
|
setLoading(true);
|
|
52
82
|
onMoreView();
|
|
53
83
|
setLoading(false);
|
|
54
|
-
}}/>)}
|
|
84
|
+
}}/>)}{' '}
|
|
85
|
+
{tab === '전체' && isMobileSize === true && (<ViewMore flag={allTabList.length != listCount.success} func={() => {
|
|
86
|
+
getAllPage();
|
|
87
|
+
}} loading={loading}/>)}
|
|
55
88
|
</div>) : (<></>)}
|
|
56
89
|
</>)) : null}
|
|
57
90
|
</>);
|