@daeryun/dr_components 0.4.37 → 0.4.39
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 +12 -0
- package/dist/components/common/integrate/index.jsx +71 -0
- package/dist/components/common/integrate/index.tsx +79 -0
- package/dist/components/page/Integrate/Broadcast.d.ts +20 -0
- package/dist/components/page/Integrate/Broadcast.jsx +107 -0
- package/dist/components/page/Integrate/Broadcast.tsx +246 -0
- package/dist/components/page/Integrate/Field.d.ts +21 -0
- package/dist/components/page/Integrate/Field.jsx +53 -0
- package/dist/components/page/Integrate/Field.tsx +119 -0
- package/dist/components/page/Integrate/LawInfo.d.ts +21 -0
- package/dist/components/page/Integrate/LawInfo.jsx +40 -0
- package/dist/components/page/Integrate/LawInfo.tsx +116 -0
- package/dist/components/page/Integrate/Map.d.ts +20 -0
- package/dist/components/page/Integrate/Map.jsx +131 -0
- package/dist/components/page/Integrate/Map.tsx +266 -0
- package/dist/components/page/Integrate/MenuTab.d.ts +18 -0
- package/dist/components/page/Integrate/MenuTab.jsx +90 -0
- package/dist/components/page/Integrate/MenuTab.tsx +160 -0
- package/dist/components/page/Integrate/NoResult.d.ts +2 -0
- package/dist/components/page/Integrate/NoResult.jsx +14 -0
- package/dist/components/page/Integrate/NoResult.tsx +23 -0
- package/dist/components/page/Integrate/Reply.d.ts +21 -0
- package/dist/components/page/Integrate/Reply.jsx +68 -0
- package/dist/components/page/Integrate/Reply.tsx +162 -0
- package/dist/components/page/Integrate/SearchData.d.ts +19 -0
- package/dist/components/page/Integrate/SearchData.jsx +166 -0
- package/dist/components/page/Integrate/SearchData.tsx +273 -0
- package/dist/components/page/Integrate/Success.d.ts +21 -0
- package/dist/components/page/Integrate/Success.jsx +74 -0
- package/dist/components/page/Integrate/Success.tsx +167 -0
- package/dist/components/page/Integrate/Title.d.ts +10 -0
- package/dist/components/page/Integrate/Title.jsx +27 -0
- package/dist/components/page/Integrate/Title.tsx +62 -0
- package/dist/components/page/Integrate/ViewMore.d.ts +9 -0
- package/dist/components/page/Integrate/ViewMore.jsx +28 -0
- package/dist/components/page/Integrate/ViewMore.tsx +66 -0
- package/dist/components/page/Integrate/integrateType.d.ts +159 -0
- package/dist/components/page/Integrate/integrateType.js +30 -0
- package/dist/components/page/Integrate/integrateType.ts +171 -0
- package/dist/components/page/Login/LoginComp/Modal/AlertConfirmModal.jsx +2 -0
- package/dist/components/page/Login/LoginComp/Modal/AlertConfirmModal.tsx +3 -0
- package/dist/components/page/Login/LoginComp/Modal/ConfirmModal.jsx +2 -0
- package/dist/components/page/Login/LoginComp/Modal/ConfirmModal.tsx +2 -0
- package/dist/components/page/Login/LoginComp/Modal/TermModal.jsx +2 -0
- package/dist/components/page/Login/LoginComp/Modal/TermModal.tsx +2 -0
- package/dist/components/page/Login/_hooks/useModalScroll.d.ts +1 -0
- package/dist/components/page/Login/_hooks/useModalScroll.js +13 -0
- package/dist/components/page/Login/_hooks/useModalScroll.ts +15 -0
- package/dist/components/page/index.d.ts +2 -0
- package/dist/components/page/index.js +2 -0
- package/dist/components/page/index.ts +2 -0
- package/dist/styles/globals.css +938 -158
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { RefObject, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useRouter } from 'next/navigation';
|
|
5
|
+
import { useSearchParams } from 'next/navigation';
|
|
6
|
+
import Link from 'next/link';
|
|
7
|
+
import { tabTypes } from '../../common/integrate';
|
|
8
|
+
import Strength from '../Strength/Strength';
|
|
9
|
+
|
|
10
|
+
interface TabProps {
|
|
11
|
+
search: string | null;
|
|
12
|
+
searchDoneRef: RefObject<HTMLAnchorElement>;
|
|
13
|
+
setChoiceTabValue?: React.Dispatch<React.SetStateAction<string>>;
|
|
14
|
+
count: {
|
|
15
|
+
lawyer: number;
|
|
16
|
+
field: number;
|
|
17
|
+
success: number;
|
|
18
|
+
info: number;
|
|
19
|
+
broadcast: number;
|
|
20
|
+
reply: number;
|
|
21
|
+
map: number;
|
|
22
|
+
};
|
|
23
|
+
totalCount: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const MenuTab = ({ search, searchDoneRef, setChoiceTabValue, totalCount, count }: TabProps) => {
|
|
27
|
+
const router = useRouter();
|
|
28
|
+
const [tab, setTab] = useState<string>('');
|
|
29
|
+
const searchParams = useSearchParams();
|
|
30
|
+
const querySearch = searchParams.get('search');
|
|
31
|
+
const queryTab = searchParams.get('tab');
|
|
32
|
+
|
|
33
|
+
const handleChange = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
|
34
|
+
await router.push(`/integrate?search=${querySearch}&tab=${event.target.value}`);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const onClickEvent = async (tab: any, search: any) => {
|
|
38
|
+
await router.push(`/integrate?search=${querySearch}&tab=${tab}`);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setTab(String(queryTab));
|
|
43
|
+
|
|
44
|
+
setChoiceTabValue?.(queryTab ? String(queryTab) : '전체'); // 부모에게 tab button value 넘겨주는 setState
|
|
45
|
+
}, [searchParams]);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<div className={'mx-auto w-full max-sm:hidden '}>
|
|
50
|
+
<Link
|
|
51
|
+
href={
|
|
52
|
+
tab !== '전체'
|
|
53
|
+
? `/integrate?search=${querySearch}&tab=전체`
|
|
54
|
+
: `/integrate?search=${querySearch}&tab=${tab}`
|
|
55
|
+
}
|
|
56
|
+
ref={searchDoneRef}
|
|
57
|
+
className={`
|
|
58
|
+
${totalCount < 1 ? 'hidden' : ''}
|
|
59
|
+
${tab === '전체' ? ' bg-[#285FA7] text-[#fff] ' : 'bg-[#F8F8F8] '}
|
|
60
|
+
mt-12 flex h-[56px] cursor-pointer items-center justify-center rounded-[30px] text-center font-semibold sm:h-[50px] sm:w-[155px]
|
|
61
|
+
sm:text-[16px] lg:w-[165px] lg:text-[17px] `}
|
|
62
|
+
onKeyDown={e => {
|
|
63
|
+
if (e.key === 'Enter') {
|
|
64
|
+
if (tab === '전체') {
|
|
65
|
+
document.getElementById('integrate-result')?.querySelector('a')?.focus();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}}
|
|
69
|
+
aria-label={
|
|
70
|
+
'전체 ' +
|
|
71
|
+
totalCount.toLocaleString() +
|
|
72
|
+
'개의 검색결과 보기 ' +
|
|
73
|
+
`${tab === '전체' ? '선택된 메뉴입니다.' : ''}`
|
|
74
|
+
}
|
|
75
|
+
>
|
|
76
|
+
전체 ({totalCount.toLocaleString()})
|
|
77
|
+
</Link>
|
|
78
|
+
<div className={'mb-16 mt-3 flex-col flex-wrap gap-2 sm:flex sm:w-auto sm:flex-row'}>
|
|
79
|
+
{tabTypes.map(item => {
|
|
80
|
+
return (
|
|
81
|
+
<TabButton
|
|
82
|
+
key={item.value}
|
|
83
|
+
tab={tab}
|
|
84
|
+
count={
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
count[String(item.value)]
|
|
87
|
+
}
|
|
88
|
+
title={item.tab}
|
|
89
|
+
type={item.value}
|
|
90
|
+
onClickEvent={onClickEvent}
|
|
91
|
+
search={search}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
})}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
{/*모바일*/}
|
|
98
|
+
<div
|
|
99
|
+
className={
|
|
100
|
+
"relative after:absolute after:right-[2em] after:top-[1.2em] after:h-[10px] after:w-[10px] after:rotate-[135deg] after:border-r-[2px] after:border-t-[2px] after:border-[#fff] after:content-[''] sm:hidden"
|
|
101
|
+
}
|
|
102
|
+
>
|
|
103
|
+
<select
|
|
104
|
+
onChange={handleChange}
|
|
105
|
+
aria-label={'search-tab'}
|
|
106
|
+
className="z-9 relative my-10 block w-full appearance-none rounded-[30px] border border-gray-400 bg-[#285FA7] px-6 py-3 text-[18px] font-[800] text-[#fff] hover:border-gray-500 sm:hidden"
|
|
107
|
+
>
|
|
108
|
+
<option value="전체">
|
|
109
|
+
전체
|
|
110
|
+
{`(${totalCount.toLocaleString()})`}
|
|
111
|
+
</option>
|
|
112
|
+
|
|
113
|
+
{tabTypes.map(t => {
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
const tabNum = count[t.value];
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
tabNum > 0 && (
|
|
119
|
+
<option value={t.value} key={t.value}>
|
|
120
|
+
{t.tab} {`(${tabNum.toLocaleString()})`}
|
|
121
|
+
</option>
|
|
122
|
+
)
|
|
123
|
+
);
|
|
124
|
+
})}
|
|
125
|
+
</select>
|
|
126
|
+
</div>
|
|
127
|
+
</>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
interface ITabButtonTypes {
|
|
132
|
+
tab: string;
|
|
133
|
+
count: number;
|
|
134
|
+
type: string;
|
|
135
|
+
title: string;
|
|
136
|
+
onClickEvent: (type: string, search: any) => Promise<void>;
|
|
137
|
+
search: any;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const TabButton = (props: ITabButtonTypes) => {
|
|
141
|
+
const searchParams = useSearchParams();
|
|
142
|
+
const buttonClass =
|
|
143
|
+
'block flex items-center justify-center sm:w-[155px] sm:text-[16px] lg:w-[165px] lg:text-[17px] text-center cursor-pointer font-semibold rounded-[30px] h-[56px] ';
|
|
144
|
+
const { tab, count, type, title, onClickEvent, search } = props;
|
|
145
|
+
const querySearch = searchParams.get('search');
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<Link
|
|
149
|
+
href={`/integrate?search=${querySearch}&tab=${type}`}
|
|
150
|
+
className={`${tab === type ? ' bg-[#285FA7] text-[#fff] ' : ' bg-[#F8F8F8] '} ${buttonClass} ${
|
|
151
|
+
count < 1 ? 'hidden' : ''
|
|
152
|
+
}`}
|
|
153
|
+
>
|
|
154
|
+
{`${title}`}
|
|
155
|
+
{` (${count.toLocaleString()})`}
|
|
156
|
+
</Link>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export default MenuTab;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { useTranslation } from 'next-i18next';
|
|
4
|
+
export const NoResult = () => {
|
|
5
|
+
const { t } = useTranslation('common');
|
|
6
|
+
return (<section>
|
|
7
|
+
<div className={'m-auto mb-72 mt-40 flex flex-col items-center font-[SUIT] max-sm:mb-40'}>
|
|
8
|
+
<div className={'relative h-[80px] w-[80px] rounded-full border-[2px] border-solid border-[#3669AC]'}>
|
|
9
|
+
<Image src={'/images/integrate/no.webp'} alt={''} width={50} height={80} className={'absolute right-[35px] top-[25px] h-[30px] w-[6px]'}/>
|
|
10
|
+
</div>
|
|
11
|
+
<p className={'mt-4 text-[26px] font-[800] text-[#3669AC] max-sm:text-[22px]'}>검색 결과가 없습니다.</p>
|
|
12
|
+
</div>
|
|
13
|
+
</section>);
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { useTranslation } from 'next-i18next';
|
|
4
|
+
|
|
5
|
+
export const NoResult = () => {
|
|
6
|
+
const { t } = useTranslation('common');
|
|
7
|
+
return (
|
|
8
|
+
<section>
|
|
9
|
+
<div className={'m-auto mb-72 mt-40 flex flex-col items-center font-[SUIT] max-sm:mb-40'}>
|
|
10
|
+
<div className={'relative h-[80px] w-[80px] rounded-full border-[2px] border-solid border-[#3669AC]'}>
|
|
11
|
+
<Image
|
|
12
|
+
src={'/images/integrate/no.webp'}
|
|
13
|
+
alt={''}
|
|
14
|
+
width={50}
|
|
15
|
+
height={80}
|
|
16
|
+
className={'absolute right-[35px] top-[25px] h-[30px] w-[6px]'}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
<p className={'mt-4 text-[26px] font-[800] text-[#3669AC] max-sm:text-[22px]'}>검색 결과가 없습니다.</p>
|
|
20
|
+
</div>
|
|
21
|
+
</section>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IListPagesType, IListTypes } from './integrateType';
|
|
3
|
+
declare const Reply: (props: {
|
|
4
|
+
tab: string;
|
|
5
|
+
onMoreViewText: (str: string) => void;
|
|
6
|
+
onMoreView: () => void;
|
|
7
|
+
list: IListTypes;
|
|
8
|
+
pages: IListPagesType;
|
|
9
|
+
crime_code: string;
|
|
10
|
+
search: string;
|
|
11
|
+
listCount: {
|
|
12
|
+
lawyer: number;
|
|
13
|
+
field: number;
|
|
14
|
+
success: number;
|
|
15
|
+
info: number;
|
|
16
|
+
broadcast: number;
|
|
17
|
+
reply: number;
|
|
18
|
+
map: number;
|
|
19
|
+
};
|
|
20
|
+
}) => React.JSX.Element;
|
|
21
|
+
export default Reply;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import Link from 'next/link';
|
|
3
|
+
import { NoResult } from './NoResult';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import { Title } from './Title';
|
|
6
|
+
import { ViewMore } from './ViewMore';
|
|
7
|
+
import { useTranslation } from 'next-i18next';
|
|
8
|
+
import { searchColorText } from '../../common/integrate';
|
|
9
|
+
const Reply = (props) => {
|
|
10
|
+
const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
|
|
11
|
+
const [loading, setLoading] = useState(false);
|
|
12
|
+
const { t } = useTranslation('common');
|
|
13
|
+
const firstAddRef = useRef(null);
|
|
14
|
+
// useEffect(() => {
|
|
15
|
+
// if (list.replyList.length > 12) firstAddRef.current?.focus();
|
|
16
|
+
// }, [list.replyList]);
|
|
17
|
+
//
|
|
18
|
+
// useEffect(() => {
|
|
19
|
+
// if (tab === 'reply') firstAddRef.current?.focus();
|
|
20
|
+
// }, [tab]);
|
|
21
|
+
return (<>
|
|
22
|
+
{tab === '전체' || tab === 'reply' ? (tab === 'reply' && listCount.reply < 1 ? (<NoResult />) : (<>
|
|
23
|
+
{listCount.reply > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
|
|
24
|
+
<Title title={'고객후기'} tab={tab} type={'reply'} onClick={str => onMoreViewText(str)} count={listCount.reply}/>
|
|
25
|
+
|
|
26
|
+
<div className={'mb-9 mt-8 grid gap-[18px] sm:grid-cols-2'}>
|
|
27
|
+
{(tab === '전체' ? list.replyList.slice(0, 4) : list.replyList).map((item, index) => {
|
|
28
|
+
return (<div key={item.id} className={'h-[280px] border-[5px] border-solid border-[#EAEAEA] p-7 max-xs:h-[190px] max-xs:p-4 sm:p-8 '}>
|
|
29
|
+
<Link href={(item.crime_code != props.crime_code
|
|
30
|
+
? 'https://www.daeryunlaw.com'
|
|
31
|
+
: '') +
|
|
32
|
+
'/reply/' +
|
|
33
|
+
item.id} target={item.crime_code === props.crime_code ? '' : '_blank'} ref={index === 0 ||
|
|
34
|
+
(index > 12 && index === list.replyList.length - 12)
|
|
35
|
+
? firstAddRef
|
|
36
|
+
: null}>
|
|
37
|
+
<div className={'flex flex-col'}>
|
|
38
|
+
<p className={'h-[70px] text-[20px] font-[800] max-xs:h-[60px] max-xs:text-[18px] sm:text-[22px]'}>
|
|
39
|
+
<span className={'text-[#285FA7]'}>{item.etc4} </span>
|
|
40
|
+
<br className={'block sm:hidden'}/>
|
|
41
|
+
{item.etc5}
|
|
42
|
+
</p>
|
|
43
|
+
<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]'}>
|
|
44
|
+
{searchColorText(item.summary
|
|
45
|
+
.replaceAll(/<(\/)?[a-zA-Z0-9]*(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi, '')
|
|
46
|
+
.replaceAll(' ', ' '), search)}
|
|
47
|
+
</p>
|
|
48
|
+
<div className={'mt-6 flex items-center text-[#666666] sm:mt-8'}>
|
|
49
|
+
<p className={'w-[20%] text-[17px] max-xl:w-[35%] max-md:w-[50%] max-sm:w-[30%] max-sm:text-[15px]'}>
|
|
50
|
+
{dayjs(item.timestamp).format('YYYY.MM.DD')}
|
|
51
|
+
</p>
|
|
52
|
+
<div className={'h-[2px] w-[80%] bg-[#D8D8D8] max-xl:w-[65%] max-md:w-[50%] max-sm:w-[70%]'}></div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</Link>
|
|
56
|
+
</div>);
|
|
57
|
+
})}
|
|
58
|
+
</div>
|
|
59
|
+
{tab != '전체' && (<ViewMore flag={list.replyList.length != listCount.reply} loading={loading} totalPage={Math.ceil(listCount.reply / 12)} nowPage={pages.replyList} func={() => {
|
|
60
|
+
setLoading(true);
|
|
61
|
+
onMoreView();
|
|
62
|
+
setLoading(false);
|
|
63
|
+
}}/>)}
|
|
64
|
+
</div>) : (<></>)}
|
|
65
|
+
</>)) : null}
|
|
66
|
+
</>);
|
|
67
|
+
};
|
|
68
|
+
export default Reply;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import Link from 'next/link';
|
|
4
|
+
import { NoResult } from './NoResult';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import { IListPagesType, IListTypes } from './integrateType';
|
|
7
|
+
import { Title } from './Title';
|
|
8
|
+
import { ViewMore } from './ViewMore';
|
|
9
|
+
import { useTranslation } from 'next-i18next';
|
|
10
|
+
import { searchColorText } from '../../common/integrate';
|
|
11
|
+
|
|
12
|
+
const Reply = (props: {
|
|
13
|
+
tab: string;
|
|
14
|
+
onMoreViewText: (str: string) => void;
|
|
15
|
+
onMoreView: () => void;
|
|
16
|
+
list: IListTypes;
|
|
17
|
+
pages: IListPagesType;
|
|
18
|
+
crime_code: string;
|
|
19
|
+
search: string;
|
|
20
|
+
listCount: {
|
|
21
|
+
lawyer: number;
|
|
22
|
+
field: number;
|
|
23
|
+
success: number;
|
|
24
|
+
info: number;
|
|
25
|
+
broadcast: number;
|
|
26
|
+
reply: number;
|
|
27
|
+
map: number;
|
|
28
|
+
};
|
|
29
|
+
}) => {
|
|
30
|
+
const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
|
|
31
|
+
|
|
32
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
33
|
+
|
|
34
|
+
const { t } = useTranslation('common');
|
|
35
|
+
const firstAddRef = useRef<HTMLAnchorElement>(null);
|
|
36
|
+
|
|
37
|
+
// useEffect(() => {
|
|
38
|
+
// if (list.replyList.length > 12) firstAddRef.current?.focus();
|
|
39
|
+
// }, [list.replyList]);
|
|
40
|
+
//
|
|
41
|
+
// useEffect(() => {
|
|
42
|
+
// if (tab === 'reply') firstAddRef.current?.focus();
|
|
43
|
+
// }, [tab]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{tab === '전체' || tab === 'reply' ? (
|
|
48
|
+
tab === 'reply' && listCount.reply < 1 ? (
|
|
49
|
+
<NoResult />
|
|
50
|
+
) : (
|
|
51
|
+
<>
|
|
52
|
+
{listCount.reply > 0 ? (
|
|
53
|
+
<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
|
|
54
|
+
<Title
|
|
55
|
+
title={'고객후기'}
|
|
56
|
+
tab={tab}
|
|
57
|
+
type={'reply'}
|
|
58
|
+
onClick={str => onMoreViewText(str)}
|
|
59
|
+
count={listCount.reply}
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<div className={'mb-9 mt-8 grid gap-[18px] sm:grid-cols-2'}>
|
|
63
|
+
{(tab === '전체' ? list.replyList.slice(0, 4) : list.replyList).map(
|
|
64
|
+
(item, index) => {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
key={item.id}
|
|
68
|
+
className={
|
|
69
|
+
'h-[280px] border-[5px] border-solid border-[#EAEAEA] p-7 max-xs:h-[190px] max-xs:p-4 sm:p-8 '
|
|
70
|
+
}
|
|
71
|
+
>
|
|
72
|
+
<Link
|
|
73
|
+
href={
|
|
74
|
+
(item.crime_code != props.crime_code
|
|
75
|
+
? 'https://www.daeryunlaw.com'
|
|
76
|
+
: '') +
|
|
77
|
+
'/reply/' +
|
|
78
|
+
item.id
|
|
79
|
+
}
|
|
80
|
+
target={item.crime_code === props.crime_code ? '' : '_blank'}
|
|
81
|
+
ref={
|
|
82
|
+
index === 0 ||
|
|
83
|
+
(index > 12 && index === list.replyList.length - 12)
|
|
84
|
+
? firstAddRef
|
|
85
|
+
: null
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
<div className={'flex flex-col'}>
|
|
89
|
+
<p
|
|
90
|
+
className={
|
|
91
|
+
'h-[70px] text-[20px] font-[800] max-xs:h-[60px] max-xs:text-[18px] sm:text-[22px]'
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
<span className={'text-[#285FA7]'}>{item.etc4} </span>
|
|
95
|
+
<br className={'block sm:hidden'} />
|
|
96
|
+
{item.etc5}
|
|
97
|
+
</p>
|
|
98
|
+
<p
|
|
99
|
+
className={
|
|
100
|
+
'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]'
|
|
101
|
+
}
|
|
102
|
+
>
|
|
103
|
+
{searchColorText(
|
|
104
|
+
item.summary
|
|
105
|
+
.replaceAll(
|
|
106
|
+
/<(\/)?[a-zA-Z0-9]*(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/gi,
|
|
107
|
+
''
|
|
108
|
+
)
|
|
109
|
+
.replaceAll(' ', ' '),
|
|
110
|
+
search
|
|
111
|
+
)}
|
|
112
|
+
</p>
|
|
113
|
+
<div
|
|
114
|
+
className={
|
|
115
|
+
'mt-6 flex items-center text-[#666666] sm:mt-8'
|
|
116
|
+
}
|
|
117
|
+
>
|
|
118
|
+
<p
|
|
119
|
+
className={
|
|
120
|
+
'w-[20%] text-[17px] max-xl:w-[35%] max-md:w-[50%] max-sm:w-[30%] max-sm:text-[15px]'
|
|
121
|
+
}
|
|
122
|
+
>
|
|
123
|
+
{dayjs(item.timestamp).format('YYYY.MM.DD')}
|
|
124
|
+
</p>
|
|
125
|
+
<div
|
|
126
|
+
className={
|
|
127
|
+
'h-[2px] w-[80%] bg-[#D8D8D8] max-xl:w-[65%] max-md:w-[50%] max-sm:w-[70%]'
|
|
128
|
+
}
|
|
129
|
+
></div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</Link>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
{tab != '전체' && (
|
|
139
|
+
<ViewMore
|
|
140
|
+
flag={list.replyList.length != listCount.reply}
|
|
141
|
+
loading={loading}
|
|
142
|
+
totalPage={Math.ceil(listCount.reply / 12)}
|
|
143
|
+
nowPage={pages.replyList}
|
|
144
|
+
func={() => {
|
|
145
|
+
setLoading(true);
|
|
146
|
+
onMoreView();
|
|
147
|
+
setLoading(false);
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
) : (
|
|
153
|
+
<></>
|
|
154
|
+
)}
|
|
155
|
+
</>
|
|
156
|
+
)
|
|
157
|
+
) : null}
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default Reply;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IListTypes } from './integrateType';
|
|
3
|
+
declare const SearchData: ({ list: propsList, totalCount, listCount, center_code, crime_code }: {
|
|
4
|
+
list: IListTypes;
|
|
5
|
+
totalCount: number;
|
|
6
|
+
center_code: string;
|
|
7
|
+
crime_code: string;
|
|
8
|
+
listCount: {
|
|
9
|
+
lawyer: number;
|
|
10
|
+
field: number;
|
|
11
|
+
success: number;
|
|
12
|
+
info: number;
|
|
13
|
+
broadcast: number;
|
|
14
|
+
reply: number;
|
|
15
|
+
map: number;
|
|
16
|
+
};
|
|
17
|
+
}) => React.JSX.Element;
|
|
18
|
+
export default SearchData;
|
|
19
|
+
export declare function paramFetch(url: string, sendData: Record<string, any>, processFn: (data: any) => void | Promise<void>): Promise<void>;
|
|
@@ -0,0 +1,166 @@
|
|
|
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, useEffect } from 'react';
|
|
11
|
+
import { NoResult } from './NoResult';
|
|
12
|
+
import { searchInit } from './integrateType';
|
|
13
|
+
import { useRouter } from 'next/router';
|
|
14
|
+
// import Lawyer from './Lawyer';
|
|
15
|
+
import Field from './Field';
|
|
16
|
+
import Success from './Success';
|
|
17
|
+
import LawInfo from './LawInfo';
|
|
18
|
+
import Broadcast from './Broadcast';
|
|
19
|
+
import Reply from './Reply';
|
|
20
|
+
import Map from './Map';
|
|
21
|
+
const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime_code }) => {
|
|
22
|
+
const router = useRouter();
|
|
23
|
+
const [tab, setTab] = useState('');
|
|
24
|
+
const [search, setSearch] = useState('');
|
|
25
|
+
const [list, setList] = useState(searchInit.list);
|
|
26
|
+
const [pages, setPages] = useState(searchInit.pages);
|
|
27
|
+
const handleMoreView = (key, data) => {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
setPages(Object.assign(Object.assign({}, pages), { [key]: pages[key] + 1 }));
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
setList(Object.assign(Object.assign({}, list), { [key]: [...list[key], ...data] }));
|
|
32
|
+
};
|
|
33
|
+
const handleMoreViewText = (tab) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
yield router.push(`/integrate?search=${router.query.search}&tab=${tab}`);
|
|
35
|
+
});
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setList(propsList);
|
|
38
|
+
}, [propsList]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setSearch(String(router.query.search));
|
|
41
|
+
setTab(String(router.query.tab));
|
|
42
|
+
// setPages(searchInit.pages)
|
|
43
|
+
}, [router.query]);
|
|
44
|
+
return (<span id={'integrate-result'}>
|
|
45
|
+
{tab === '전체' && totalCount < 1 ? (<NoResult />) : (<>
|
|
46
|
+
<Success center_code={center_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
47
|
+
paramFetch('/api/integrate/list', {
|
|
48
|
+
page: pages.successList,
|
|
49
|
+
type: 'success',
|
|
50
|
+
search: search,
|
|
51
|
+
center_code: center_code,
|
|
52
|
+
crime_code: crime_code
|
|
53
|
+
}, (obj) => {
|
|
54
|
+
handleMoreView('successList', obj.data.list.successList);
|
|
55
|
+
});
|
|
56
|
+
}} search={search} listCount={listCount}/>
|
|
57
|
+
|
|
58
|
+
<Reply crime_code={crime_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
59
|
+
paramFetch('/api/integrate/list', {
|
|
60
|
+
page: pages.replyList,
|
|
61
|
+
type: 'reply',
|
|
62
|
+
search: search,
|
|
63
|
+
center_code: center_code,
|
|
64
|
+
crime_code: crime_code
|
|
65
|
+
}, (obj) => {
|
|
66
|
+
handleMoreView('replyList', obj.data.list.replyList);
|
|
67
|
+
});
|
|
68
|
+
}} listCount={listCount} search={search}/>
|
|
69
|
+
|
|
70
|
+
<LawInfo center_code={center_code} tab={tab} list={list} pages={pages} listCount={listCount} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
71
|
+
paramFetch('/api/integrate/list', {
|
|
72
|
+
page: pages.infoList,
|
|
73
|
+
type: 'info',
|
|
74
|
+
search: search,
|
|
75
|
+
center_code: center_code,
|
|
76
|
+
crime_code: crime_code
|
|
77
|
+
}, (obj) => {
|
|
78
|
+
handleMoreView('infoList', obj.data.list.infoList);
|
|
79
|
+
});
|
|
80
|
+
}} search={search}/>
|
|
81
|
+
|
|
82
|
+
{/*<Lawyer*/}
|
|
83
|
+
{/* tab={tab}*/}
|
|
84
|
+
{/* listCount={listCount}*/}
|
|
85
|
+
{/* list={list}*/}
|
|
86
|
+
{/* pages={pages}*/}
|
|
87
|
+
{/* center_code={center_code}*/}
|
|
88
|
+
{/* onMoreViewText={handleMoreViewText}*/}
|
|
89
|
+
{/* onMoreView={() => {*/}
|
|
90
|
+
{/* paramFetch(*/}
|
|
91
|
+
{/* `api/integrate/list`,*/}
|
|
92
|
+
{/* {*/}
|
|
93
|
+
{/* page: pages.lawyerList,*/}
|
|
94
|
+
{/* type: 'lawyer',*/}
|
|
95
|
+
{/* search: search,*/}
|
|
96
|
+
{/* center_code: center_code,*/}
|
|
97
|
+
{/* crime_code: crime_code*/}
|
|
98
|
+
{/* },*/}
|
|
99
|
+
{/* (obj: any) => {*/}
|
|
100
|
+
{/* handleMoreView('lawyerList', obj.data.list.lawyerList);*/}
|
|
101
|
+
{/* }*/}
|
|
102
|
+
{/* );*/}
|
|
103
|
+
{/* }}*/}
|
|
104
|
+
{/*/>*/}
|
|
105
|
+
|
|
106
|
+
<Broadcast listCount={listCount} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
107
|
+
paramFetch('/api/integrate/list', {
|
|
108
|
+
page: pages.broadcastList,
|
|
109
|
+
type: 'broadcast',
|
|
110
|
+
search: search,
|
|
111
|
+
center_code: center_code,
|
|
112
|
+
crime_code: crime_code
|
|
113
|
+
}, (obj) => {
|
|
114
|
+
handleMoreView('broadcastList', obj.data.list.broadcastList);
|
|
115
|
+
});
|
|
116
|
+
}} search={search}/>
|
|
117
|
+
|
|
118
|
+
<Field listCount={listCount} center_code={center_code} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
|
|
119
|
+
paramFetch(`/api/integrate/list`, {
|
|
120
|
+
page: pages.fieldList,
|
|
121
|
+
type: 'field',
|
|
122
|
+
search: search,
|
|
123
|
+
center_code: center_code,
|
|
124
|
+
crime_code: crime_code
|
|
125
|
+
}, (obj) => {
|
|
126
|
+
handleMoreView('fieldList', obj.data.list.fieldList);
|
|
127
|
+
});
|
|
128
|
+
}} search={search}/>
|
|
129
|
+
|
|
130
|
+
<Map listCount={listCount} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} search={search} onMoreView={() => {
|
|
131
|
+
paramFetch('/api/integrate/list', {
|
|
132
|
+
page: pages.mapList,
|
|
133
|
+
type: 'map',
|
|
134
|
+
search: search,
|
|
135
|
+
center_code: center_code,
|
|
136
|
+
crime_code: crime_code
|
|
137
|
+
}, (obj) => {
|
|
138
|
+
handleMoreView('mapList', obj.data.list.mapList);
|
|
139
|
+
});
|
|
140
|
+
}}/>
|
|
141
|
+
</>)}
|
|
142
|
+
</span>);
|
|
143
|
+
};
|
|
144
|
+
export default SearchData;
|
|
145
|
+
export function paramFetch(url, sendData, processFn) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const params = new URLSearchParams(sendData).toString();
|
|
148
|
+
const requestUrl = params ? `${url}?${params}` : url;
|
|
149
|
+
const headers = {
|
|
150
|
+
'Content-Type': 'application/json'
|
|
151
|
+
};
|
|
152
|
+
const requestOptions = {
|
|
153
|
+
method: 'GET',
|
|
154
|
+
headers
|
|
155
|
+
};
|
|
156
|
+
try {
|
|
157
|
+
const response = yield fetch(requestUrl, requestOptions);
|
|
158
|
+
const data = yield response.json();
|
|
159
|
+
// processFn이 비동기 함수일 수도 있으므로 Promise.resolve() 사용
|
|
160
|
+
yield Promise.resolve(processFn(data));
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.error('Fetch error:', error);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|