From 968843570a24bbb6d386080d4d9b3db6cea28b61 Mon Sep 17 00:00:00 2001 From: summerscar Date: Thu, 19 Dec 2024 13:45:36 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(article):=20html=20lang=20and?= =?UTF-8?q?=20prefetch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../article/[slug]/_components/movie.tsx | 1 + .../article/[slug]/_components/text.tsx | 1 + app/(home)/article/[slug]/page.tsx | 22 +++++++++++-------- app/(home)/article/page.tsx | 4 +++- app/components/header/_component/search.tsx | 13 +++++------ app/components/render-md-server.tsx | 10 +++++++-- app/styles/_markdown.css | 2 +- 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/app/(home)/article/[slug]/_components/movie.tsx b/app/(home)/article/[slug]/_components/movie.tsx index b72b3c6..0a218e3 100644 --- a/app/(home)/article/[slug]/_components/movie.tsx +++ b/app/(home)/article/[slug]/_components/movie.tsx @@ -379,6 +379,7 @@ const ArticleRender = memo(

{cue.text}

diff --git a/app/(home)/article/[slug]/_components/text.tsx b/app/(home)/article/[slug]/_components/text.tsx index e09fb7c..086714e 100644 --- a/app/(home)/article/[slug]/_components/text.tsx +++ b/app/(home)/article/[slug]/_components/text.tsx @@ -8,6 +8,7 @@ const Text = ({ content }: { content: string }) => { return ( diff --git a/app/(home)/article/[slug]/page.tsx b/app/(home)/article/[slug]/page.tsx index 7eb05bc..ffde99b 100644 --- a/app/(home)/article/[slug]/page.tsx +++ b/app/(home)/article/[slug]/page.tsx @@ -5,6 +5,7 @@ import { getArticleRevalidateKey, } from "@/actions/user-dict-utils"; import { RenderMDTextServer } from "@/components/render-md-server"; +import { SelectToSearch } from "@/hooks/use-select-to-search"; import type { SubtitleCues, SubtitleSeries } from "@/types/article"; import { notoKR } from "@/utils/fonts"; import { getBaseURL } from "@/utils/get-base-url"; @@ -103,15 +104,18 @@ const SlugPage = async ({ )}
-
- dangerouslySetInnerHTML={{ __html: article.title }} - /> + +
+ dangerouslySetInnerHTML={{ __html: article.title }} + lang="ko" + /> +
{ return (
- {sortedArticles.map(async (article) => ( + {sortedArticles.map((article, index) => (
{ key={article.id} href={`/article/${article.id}`} className="block w-full" + prefetch={article.type === "TEXT" && index < 6} > { style={{ viewTransitionName: `article-title-${article.id}` }} // biome-ignore lint/security/noDangerouslySetInnerHtml: dangerouslySetInnerHTML={{ __html: article.title }} + lang="ko" />
{ const tHeader = useTranslations("Header"); - const [isInputFocused, setIsInputFocused] = useState(false); const [query, setQuery] = useState(""); const [results, setResults] = useState([]); const [searchIndex, setSearchIndex] = @@ -107,7 +106,7 @@ const Search = () => { }; return ( -
+
    {results.map((res) => (
  • - +
    {[tHeader(res.level), ...res.relativeReadablePath].join(" > ")}
    diff --git a/app/components/render-md-server.tsx b/app/components/render-md-server.tsx index 5a048c6..2eb8cb1 100644 --- a/app/components/render-md-server.tsx +++ b/app/components/render-md-server.tsx @@ -1,16 +1,22 @@ import { components } from "@/components/markdown-render"; import clsx from "clsx"; import { compileMDX } from "next-mdx-remote/rsc"; +import type { ComponentProps } from "react"; const RenderMDTextServer = async ({ text, className, -}: { text: string; className?: string }) => { + ...props +}: { text: string } & ComponentProps<"div">) => { const { content } = await compileMDX({ source: text, components: { ...components }, }); - return
    {content}
    ; + return ( +
    + {content} +
    + ); }; export { RenderMDTextServer }; diff --git a/app/styles/_markdown.css b/app/styles/_markdown.css index 7c3152a..59016a0 100644 --- a/app/styles/_markdown.css +++ b/app/styles/_markdown.css @@ -58,6 +58,6 @@ } iframe { - @apply !w-[-webkit-fill-available] !h-auto !aspect-video; + @apply !w-[-webkit-fill-available] !h-auto !aspect-video rounded-lg overflow-hidden; } }