@daeryun/dr_components 0.4.40 → 0.4.42

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.
@@ -62,10 +62,14 @@ export const tabTypes = [
62
62
  { tab: '오시는길', etab: 'Map', value: 'map' }
63
63
  ];
64
64
  export const searchColorText = (title, search) => {
65
- if (search === '')
65
+ if (search.trim() === '')
66
66
  return title;
67
- const parts = title.split(new RegExp(`(${search})`, 'gi'));
68
- return parts.map((part, index) => part.toLowerCase() === search.toLowerCase() ? (<span key={index} className="font-extrabold text-[#285FA7]">
67
+ const keywords = search.split(/\s+/).filter(Boolean); // 띄어쓰기로 분리 후 빈 값 제거
68
+ const joinedKeyword = keywords.join(''); // 띄어쓰기 없는 버전
69
+ // 정규식 패턴 생성 (띄어쓰기 있는 버전 + 없는 버전)
70
+ const regex = new RegExp(`(${keywords.join('\\s*')}|${joinedKeyword})`, 'gi');
71
+ const parts = title.split(regex);
72
+ return parts.map((part, index) => part.match(regex) ? (<span key={index} className="font-extrabold text-[#285FA7]">
69
73
  {part}
70
74
  </span>) : (part));
71
75
  };
@@ -65,10 +65,17 @@ export const tabTypes: { tab: string; etab: string; value: string }[] = [
65
65
  { tab: '오시는길', etab: 'Map', value: 'map' }
66
66
  ];
67
67
  export const searchColorText = (title: string, search: string) => {
68
- if (search === '') return title;
69
- const parts = title.split(new RegExp(`(${search})`, 'gi'));
68
+ if (search.trim() === '') return title;
69
+
70
+ const keywords = search.split(/\s+/).filter(Boolean); // 띄어쓰기로 분리 후 빈 값 제거
71
+ const joinedKeyword = keywords.join(''); // 띄어쓰기 없는 버전
72
+
73
+ // 정규식 패턴 생성 (띄어쓰기 있는 버전 + 없는 버전)
74
+ const regex = new RegExp(`(${keywords.join('\\s*')}|${joinedKeyword})`, 'gi');
75
+
76
+ const parts = title.split(regex);
70
77
  return parts.map((part, index) =>
71
- part.toLowerCase() === search.toLowerCase() ? (
78
+ part.match(regex) ? (
72
79
  <span key={index} className="font-extrabold text-[#285FA7]">
73
80
  {part}
74
81
  </span>
@@ -5,22 +5,12 @@ import { NoResult } from './NoResult';
5
5
  import dayjs from 'dayjs';
6
6
  import { Title } from './Title';
7
7
  import { ViewMore } from './ViewMore';
8
- import { useTranslation } from 'next-i18next';
9
8
  import { searchColorText } from '../../common/integrate';
10
9
  import { htmlTagRemove } from '../../../lib';
11
10
  const Broadcast = (props) => {
12
11
  const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
13
12
  const [loading, setLoading] = useState(false);
14
13
  const firstAddRef = useRef(null);
15
- const { t } = useTranslation('common');
16
- //
17
- // useEffect(() => {
18
- // if (list.broadcastList.length > 12) firstAddRef.current?.focus();
19
- // }, [list.broadcastList]);
20
- //
21
- // useEffect(() => {
22
- // if (tab === 'broadcast') firstAddRef.current?.focus();
23
- // }, [tab]);
24
14
  return (<>
25
15
  {tab === '전체' || tab === 'broadcast' ? (tab === 'broadcast' && listCount.broadcast < 1 ? (<NoResult />) : (<>
26
16
  {listCount.broadcast > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
@@ -7,7 +7,6 @@ import dayjs from 'dayjs';
7
7
  import { IListPagesType, IListTypes } from './integrateType';
8
8
  import { Title } from './Title';
9
9
  import { ViewMore } from './ViewMore';
10
- import { useTranslation } from 'next-i18next';
11
10
  import { searchColorText } from '../../common/integrate';
12
11
  import { htmlTagRemove } from '../../../lib';
13
12
 
@@ -33,16 +32,6 @@ const Broadcast = (props: {
33
32
  const [loading, setLoading] = useState<boolean>(false);
34
33
  const firstAddRef = useRef<HTMLAnchorElement>(null);
35
34
 
36
- const { t } = useTranslation('common');
37
- //
38
- // useEffect(() => {
39
- // if (list.broadcastList.length > 12) firstAddRef.current?.focus();
40
- // }, [list.broadcastList]);
41
- //
42
- // useEffect(() => {
43
- // if (tab === 'broadcast') firstAddRef.current?.focus();
44
- // }, [tab]);
45
-
46
35
  return (
47
36
  <>
48
37
  {tab === '전체' || tab === 'broadcast' ? (
@@ -4,20 +4,11 @@ import { NoResult } from './NoResult';
4
4
  import uuid from 'react-uuid';
5
5
  import { ViewMore } from './ViewMore';
6
6
  import { Title } from './Title';
7
- import { useTranslation } from 'next-i18next';
8
7
  import { searchColorText } from '../../common/integrate';
9
8
  const Field = (props) => {
10
9
  const { tab, onMoreViewText, list, pages, search, onMoreView, listCount } = props;
11
10
  const [loading, setLoading] = useState(false);
12
- const { t } = useTranslation('common');
13
11
  const firstAddRef = useRef(null);
14
- // useEffect(() => {
15
- // if (list.fieldList.length > 48) firstAddRef.current?.focus();
16
- // }, [list.fieldList]);
17
- //
18
- // useEffect(() => {
19
- // if (tab === 'field') firstAddRef.current?.focus();
20
- // }, [tab]);
21
12
  return (<>
22
13
  {tab === '전체' || tab === 'field' ? (tab === 'field' && listCount.field < 1 ? (<NoResult />) : (<>
23
14
  {listCount.field > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
@@ -29,18 +29,8 @@ const Field = (props: {
29
29
  const { tab, onMoreViewText, list, pages, search, onMoreView, listCount } = props;
30
30
 
31
31
  const [loading, setLoading] = useState<boolean>(false);
32
-
33
- const { t } = useTranslation('common');
34
32
  const firstAddRef = useRef<HTMLAnchorElement>(null);
35
33
 
36
- // useEffect(() => {
37
- // if (list.fieldList.length > 48) firstAddRef.current?.focus();
38
- // }, [list.fieldList]);
39
- //
40
- // useEffect(() => {
41
- // if (tab === 'field') firstAddRef.current?.focus();
42
- // }, [tab]);
43
-
44
34
  return (
45
35
  <>
46
36
  {tab === '전체' || tab === 'field' ? (
@@ -3,7 +3,7 @@ import { NoResult } from './NoResult';
3
3
  import { Title } from './Title';
4
4
  import { IListPagesType, IListTypes } from './integrateType';
5
5
  import { ViewMore } from './ViewMore';
6
- import { insert } from '../../../lib';
6
+
7
7
  import * as gtag from '../../../lib/gtag';
8
8
  import mobile from 'is-mobile';
9
9
  import { useRouter } from 'next/router';
@@ -5,7 +5,6 @@ import { useRouter } from 'next/navigation';
5
5
  import { useSearchParams } from 'next/navigation';
6
6
  import Link from 'next/link';
7
7
  import { tabTypes } from '../../common/integrate';
8
- import Strength from '../Strength/Strength';
9
8
 
10
9
  interface TabProps {
11
10
  search: string | null;
@@ -4,20 +4,11 @@ import { NoResult } from './NoResult';
4
4
  import dayjs from 'dayjs';
5
5
  import { Title } from './Title';
6
6
  import { ViewMore } from './ViewMore';
7
- import { useTranslation } from 'next-i18next';
8
7
  import { searchColorText } from '../../common/integrate';
9
8
  const Reply = (props) => {
10
9
  const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
11
10
  const [loading, setLoading] = useState(false);
12
- const { t } = useTranslation('common');
13
11
  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
12
  return (<>
22
13
  {tab === '전체' || tab === 'reply' ? (tab === 'reply' && listCount.reply < 1 ? (<NoResult />) : (<>
23
14
  {listCount.reply > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
@@ -31,17 +31,8 @@ const Reply = (props: {
31
31
 
32
32
  const [loading, setLoading] = useState<boolean>(false);
33
33
 
34
- const { t } = useTranslation('common');
35
34
  const firstAddRef = useRef<HTMLAnchorElement>(null);
36
35
 
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
36
  return (
46
37
  <>
47
38
  {tab === '전체' || tab === 'reply' ? (
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -11,13 +12,13 @@ import React, { useState, useEffect } from 'react';
11
12
  import { NoResult } from './NoResult';
12
13
  import { searchInit } from './integrateType';
13
14
  import { useRouter } from 'next/router';
14
- // import Lawyer from './Lawyer';
15
15
  import Field from './Field';
16
16
  import Success from './Success';
17
17
  import LawInfo from './LawInfo';
18
18
  import Broadcast from './Broadcast';
19
19
  import Reply from './Reply';
20
20
  import Map from './Map';
21
+ import Lawyer from './Lawyer';
21
22
  const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime_code }) => {
22
23
  const router = useRouter();
23
24
  const [tab, setTab] = useState('');
@@ -79,29 +80,17 @@ const SearchData = ({ list: propsList, totalCount, listCount, center_code, crime
79
80
  });
80
81
  }} search={search}/>
81
82
 
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
- {/*/>*/}
83
+ <Lawyer tab={tab} listCount={listCount} list={list} pages={pages} center_code={center_code} onMoreViewText={handleMoreViewText} onMoreView={() => {
84
+ paramFetch(`api/integrate/list`, {
85
+ page: pages.lawyerList,
86
+ type: 'lawyer',
87
+ search: search,
88
+ center_code: center_code,
89
+ crime_code: crime_code
90
+ }, (obj) => {
91
+ handleMoreView('lawyerList', obj.data.list.lawyerList);
92
+ });
93
+ }}/>
105
94
 
106
95
  <Broadcast listCount={listCount} tab={tab} list={list} pages={pages} onMoreViewText={handleMoreViewText} onMoreView={() => {
107
96
  paramFetch('/api/integrate/list', {
@@ -1,14 +1,16 @@
1
+ 'use client';
2
+
1
3
  import React, { useState, useEffect } from 'react';
2
4
  import { NoResult } from './NoResult';
3
5
  import { IListPagesType, IListTypes, searchInit } from './integrateType';
4
6
  import { useRouter } from 'next/router';
5
- // import Lawyer from './Lawyer';
6
7
  import Field from './Field';
7
8
  import Success from './Success';
8
9
  import LawInfo from './LawInfo';
9
10
  import Broadcast from './Broadcast';
10
11
  import Reply from './Reply';
11
12
  import Map from './Map';
13
+ import Lawyer from './Lawyer';
12
14
 
13
15
  const SearchData = ({
14
16
  list: propsList,
@@ -139,29 +141,29 @@ const SearchData = ({
139
141
  search={search}
140
142
  />
141
143
 
142
- {/*<Lawyer*/}
143
- {/* tab={tab}*/}
144
- {/* listCount={listCount}*/}
145
- {/* list={list}*/}
146
- {/* pages={pages}*/}
147
- {/* center_code={center_code}*/}
148
- {/* onMoreViewText={handleMoreViewText}*/}
149
- {/* onMoreView={() => {*/}
150
- {/* paramFetch(*/}
151
- {/* `api/integrate/list`,*/}
152
- {/* {*/}
153
- {/* page: pages.lawyerList,*/}
154
- {/* type: 'lawyer',*/}
155
- {/* search: search,*/}
156
- {/* center_code: center_code,*/}
157
- {/* crime_code: crime_code*/}
158
- {/* },*/}
159
- {/* (obj: any) => {*/}
160
- {/* handleMoreView('lawyerList', obj.data.list.lawyerList);*/}
161
- {/* }*/}
162
- {/* );*/}
163
- {/* }}*/}
164
- {/*/>*/}
144
+ <Lawyer
145
+ tab={tab}
146
+ listCount={listCount}
147
+ list={list}
148
+ pages={pages}
149
+ center_code={center_code}
150
+ onMoreViewText={handleMoreViewText}
151
+ onMoreView={() => {
152
+ paramFetch(
153
+ `api/integrate/list`,
154
+ {
155
+ page: pages.lawyerList,
156
+ type: 'lawyer',
157
+ search: search,
158
+ center_code: center_code,
159
+ crime_code: crime_code
160
+ },
161
+ (obj: any) => {
162
+ handleMoreView('lawyerList', obj.data.list.lawyerList);
163
+ }
164
+ );
165
+ }}
166
+ />
165
167
 
166
168
  <Broadcast
167
169
  listCount={listCount}
@@ -1,25 +1,14 @@
1
1
  import React, { useRef, 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 { Title } from './Title';
6
5
  import { ViewMore } from './ViewMore';
7
- import { useTranslation } from 'next-i18next';
8
6
  import { searchColorText } from '../../common/integrate';
9
7
  const Success = (props) => {
10
8
  var _a;
11
9
  const { tab, onMoreViewText, list, pages, onMoreView, search, listCount } = props;
12
10
  const [loading, setLoading] = useState(false);
13
- const { t } = useTranslation('common');
14
11
  const firstAddRef = useRef(null);
15
- //
16
- // useEffect(() => {
17
- // if (list.successList.length > 12) firstAddRef.current?.focus();
18
- // }, [list.successList]);
19
- //
20
- // useEffect(() => {
21
- // if (tab === 'success') firstAddRef.current?.focus();
22
- // }, [tab]);
23
12
  return (<>
24
13
  {tab === '전체' || tab === 'success' ? (tab === 'success' && listCount.success < 1 ? (<NoResult />) : (<>
25
14
  {listCount.success > 0 ? (<div className={'mb-[180px] max-sm:mb-[100px] max-xs:mb-[50px]'}>
@@ -30,7 +19,7 @@ const Success = (props) => {
30
19
  var _a, _b;
31
20
  return (<Link href={!item.center_code.includes('OF')
32
21
  ? item.pathname + 'success_new/' + item.id
33
- : `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={uuid()} ref={index === 0 ||
22
+ : `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} ref={index === 0 ||
34
23
  (index > 12 && index === list.successList.length - 12)
35
24
  ? firstAddRef
36
25
  : null}>
@@ -30,16 +30,7 @@ const Success = (props: {
30
30
 
31
31
  const [loading, setLoading] = useState<boolean>(false);
32
32
 
33
- const { t } = useTranslation('common');
34
33
  const firstAddRef = useRef<HTMLAnchorElement>(null);
35
- //
36
- // useEffect(() => {
37
- // if (list.successList.length > 12) firstAddRef.current?.focus();
38
- // }, [list.successList]);
39
- //
40
- // useEffect(() => {
41
- // if (tab === 'success') firstAddRef.current?.focus();
42
- // }, [tab]);
43
34
 
44
35
  return (
45
36
  <>
@@ -73,7 +64,7 @@ const Success = (props: {
73
64
  className={
74
65
  ' overflow-hidden border-[2px] border-solid border-[#ebebebcc]'
75
66
  }
76
- key={uuid()}
67
+ key={item.id + item.center_code}
77
68
  ref={
78
69
  index === 0 ||
79
70
  (index > 12 && index === list.successList.length - 12)