Skip to content

Commit

Permalink
Merge pull request #11 from potenday-project/bugfix
Browse files Browse the repository at this point in the history
버그픽스
  • Loading branch information
SeoYeonii authored Aug 13, 2023
2 parents 131065b + 3c944a7 commit dce4d27
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/components/ErrorFallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ const ErrorFallback = ({ error, resetErrorBoundary }: ErrorFallbackProps) => {
// eslint-disable-next-line no-unsafe-optional-chaining
const m = error.response?.data.message ?? ([] as string[]);
const mArr = m
.map((x) =>
x in ERROR_MAP ? ERROR_MAP[x as keyof typeof ERROR_MAP] : [],
)
.map((x) => {
if (x in ERROR_MAP) return ERROR_MAP[x as keyof typeof ERROR_MAP];
if (/[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/.test(x)) return x;
return [];
})
.flat();
if (mArr.length > 0) return mArr;
}
Expand Down
12 changes: 11 additions & 1 deletion src/pages/SearchDetail/components/AiTabPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const StyledTabPanel = styled.div`
width: 100%;
justify-content: center;
.title {
min-height: 23px;
background-image: linear-gradient(
to bottom,
transparent 50%,
Expand Down Expand Up @@ -164,13 +165,22 @@ const AiTabPanel = ({
setEnabled(true);
}, []);

useEffect(() => {
const el = document.getElementById("easy-title");
if (el && el.clientHeight > 23) {
el.style.background = "#fff27a";
}
}, []);

return (
<StyledTabPanel
role="tabpanel"
style={{ display: value !== selectedValue ? "none" : "flex" }}
>
<Box className="title-container">
<Box className="title">{data?.easyTitle}</Box>
<Box id="easy-title" className="title">
{data?.easyTitle}
</Box>
</Box>
<Suspense fallback={<Fallback text="더 쉽게 번역 중" />}>
<Content
Expand Down
14 changes: 12 additions & 2 deletions src/pages/SearchDetail/components/TabPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const StyledTabPanel = styled.div`
width: 100%;
justify-content: center;
.title {
min-height: 23px;
background-image: linear-gradient(
to bottom,
transparent 50%,
Expand Down Expand Up @@ -72,6 +73,13 @@ const TabPanel = ({
}
}, [data]);

useEffect(() => {
const el = document.getElementById("law-title");
if (el && el.clientHeight > 23) {
el.style.background = "#fff27a";
}
}, []);

return (
<StyledTabPanel
role="tabpanel"
Expand All @@ -80,7 +88,9 @@ const TabPanel = ({
{data?.type === "prec" && (
<>
<Box className="title-container">
<Box className="title">{data.사건명}</Box>
<Box id="law-title" className="title">
{data.사건명}
</Box>
</Box>
<Box
className="content"
Expand All @@ -91,7 +101,7 @@ const TabPanel = ({
{data?.type === "statute" && (
<>
<Box className="title-container">
<Box className="title">{`현행 법령[시행 ${(() => {
<Box id="law-title" className="title">{`현행 법령[시행 ${(() => {
const str = data.기본정보.시행일자.toString();
const year = str.slice(0, 4);
const month = str.slice(4, 6);
Expand Down

0 comments on commit dce4d27

Please sign in to comment.