@daeryun/dr_components 0.4.38 → 0.4.40

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 (50) hide show
  1. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  2. package/dist/components/common/integrate/index.d.ts +12 -0
  3. package/dist/components/common/integrate/index.jsx +71 -0
  4. package/dist/components/common/integrate/index.tsx +79 -0
  5. package/dist/components/page/Integrate/Broadcast.d.ts +20 -0
  6. package/dist/components/page/Integrate/Broadcast.jsx +107 -0
  7. package/dist/components/page/Integrate/Broadcast.tsx +246 -0
  8. package/dist/components/page/Integrate/Field.d.ts +21 -0
  9. package/dist/components/page/Integrate/Field.jsx +53 -0
  10. package/dist/components/page/Integrate/Field.tsx +119 -0
  11. package/dist/components/page/Integrate/LawInfo.d.ts +21 -0
  12. package/dist/components/page/Integrate/LawInfo.jsx +40 -0
  13. package/dist/components/page/Integrate/LawInfo.tsx +116 -0
  14. package/dist/components/page/Integrate/Lawyer.d.ts +36 -0
  15. package/dist/components/page/Integrate/Lawyer.jsx +175 -0
  16. package/dist/components/page/Integrate/Lawyer.tsx +394 -0
  17. package/dist/components/page/Integrate/Map.d.ts +20 -0
  18. package/dist/components/page/Integrate/Map.jsx +131 -0
  19. package/dist/components/page/Integrate/Map.tsx +266 -0
  20. package/dist/components/page/Integrate/MenuTab.d.ts +18 -0
  21. package/dist/components/page/Integrate/MenuTab.jsx +90 -0
  22. package/dist/components/page/Integrate/MenuTab.tsx +160 -0
  23. package/dist/components/page/Integrate/NoResult.d.ts +2 -0
  24. package/dist/components/page/Integrate/NoResult.jsx +14 -0
  25. package/dist/components/page/Integrate/NoResult.tsx +23 -0
  26. package/dist/components/page/Integrate/Reply.d.ts +21 -0
  27. package/dist/components/page/Integrate/Reply.jsx +68 -0
  28. package/dist/components/page/Integrate/Reply.tsx +162 -0
  29. package/dist/components/page/Integrate/SearchData.d.ts +19 -0
  30. package/dist/components/page/Integrate/SearchData.jsx +166 -0
  31. package/dist/components/page/Integrate/SearchData.tsx +273 -0
  32. package/dist/components/page/Integrate/Success.d.ts +21 -0
  33. package/dist/components/page/Integrate/Success.jsx +74 -0
  34. package/dist/components/page/Integrate/Success.tsx +167 -0
  35. package/dist/components/page/Integrate/Title.d.ts +10 -0
  36. package/dist/components/page/Integrate/Title.jsx +27 -0
  37. package/dist/components/page/Integrate/Title.tsx +62 -0
  38. package/dist/components/page/Integrate/ViewMore.d.ts +9 -0
  39. package/dist/components/page/Integrate/ViewMore.jsx +28 -0
  40. package/dist/components/page/Integrate/ViewMore.tsx +66 -0
  41. package/dist/components/page/Integrate/index.module.css +915 -0
  42. package/dist/components/page/Integrate/integrateType.d.ts +159 -0
  43. package/dist/components/page/Integrate/integrateType.js +30 -0
  44. package/dist/components/page/Integrate/integrateType.ts +171 -0
  45. package/dist/components/page/index.d.ts +2 -0
  46. package/dist/components/page/index.js +2 -0
  47. package/dist/components/page/index.ts +2 -0
  48. package/dist/styles/globals.css +1072 -161
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +1 -1
@@ -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('&nbsp;', ' '), 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('&nbsp;', ' '),
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
+ }