From 444524d5026f57a7a32658fbd7afe7dd310047de Mon Sep 17 00:00:00 2001 From: yunseok Date: Tue, 6 Aug 2024 20:50:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Common/Search.js | 17 +++++------------ src/owner/components/OwnerHeader.js | 2 +- src/pages/MyPage.js | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/components/Common/Search.js b/src/components/Common/Search.js index 04c574c..ae6f790 100644 --- a/src/components/Common/Search.js +++ b/src/components/Common/Search.js @@ -9,18 +9,11 @@ const Search = ({ marketList }) => { const [searchInput, setSearchInput] = useState(""); const getHighlightedText = (text, highlight) => { - const highlightIndex = Hangul.search(text, highlight); - if (highlightIndex === -1) return text; - - const startIndex = highlightIndex; - const endIndex = highlightIndex + highlight.length; - - return ( - <> - {text.substring(0, startIndex)} - {text.substring(startIndex, endIndex)} - {text.substring(endIndex)} - + const regex = new RegExp(`(${highlight})`, "gi"); + const parts = text.split(regex); + + return parts.map((part, index) => + regex.test(part) ? {part} : part ); }; diff --git a/src/owner/components/OwnerHeader.js b/src/owner/components/OwnerHeader.js index 67c409d..1732ba3 100644 --- a/src/owner/components/OwnerHeader.js +++ b/src/owner/components/OwnerHeader.js @@ -18,7 +18,7 @@ const OwnerHeader = ({ name, stores }) => { {isClicked && ( { diff --git a/src/pages/MyPage.js b/src/pages/MyPage.js index 6e98728..e61f5b3 100644 --- a/src/pages/MyPage.js +++ b/src/pages/MyPage.js @@ -94,7 +94,7 @@ const MyPage = () => { navigate("/owner"); }} > - 상인 계정 전환 + 사장님 계정 전환