@daeryun/dr_components 0.4.41 → 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' ? (
@@ -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,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)