From ba0c8d73e585d7ff249dd90684254bc7fa025544 Mon Sep 17 00:00:00 2001 From: Fushihara <1039534+fushihara@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:19:25 +0900 Subject: commit --- src/app/article/_components/articleListElement.tsx | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/app/article/_components/articleListElement.tsx (limited to 'src/app/article/_components') diff --git a/src/app/article/_components/articleListElement.tsx b/src/app/article/_components/articleListElement.tsx new file mode 100644 index 0000000..21ee947 --- /dev/null +++ b/src/app/article/_components/articleListElement.tsx @@ -0,0 +1,123 @@ +import Link from "next/link"; +import dateformat from "dateformat"; +import { ArticleLoader } from "../../../util/articleLoader"; +dateformat.i18n.dayNames = [ + '日', '月', '火', '水', '木', '金', '土', + '日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日' +]; +type DisplayData = Awaited>[number]; +export function ArticleListElement(displayData: DisplayData[]) { + return ( + + + + + + + + + + + {displayData.map(d => { + const officialLinkTitle = `公式のakiba-souken.com へのリンク。閉鎖後は繋がらなくなるはず`; + const iaSearchResultLinkTitle = `InternetArchive の検索結果へのリンク`; + const iframeLinkTitle = `Iframeを使ってInternetArchiveに記録されたアーカイブを表示します`; + const topCategory = d.breadLinks[0]; + const timestampStr = dateformat(new Date(d.timestampMs), "yyyy/mm/dd(ddd)HH:MM"); + const originalUrl = `https://akiba-souken.com/article/${d.articleId}/`; + const page2After = (() => { + if (d.maxPageNumber == 1) { + return [(<>)]; + } + const result: JSX.Element[] = [ + (
) + ]; + for (let page = 2; page <= d.maxPageNumber; page++) { + result.push( +
+ 公式 + IA検索結果 + IAをiframe Page:{page} +
+ ); + } + return result; + })(); + // パンくずリスト部分を作成 + let breadElement = (); + if (0 < d.breadLinks.length) { + const breadChildElement: JSX.Element[] = []; + breadChildElement.push(パンくずリスト:); + for (const bread of d.breadLinks) { + if (d.breadLinks.indexOf(bread) != 0) { + breadChildElement.push(); + } + // 1つ目のパンくずリストはカテゴリだけど、2つ目以降のパンくずリストはタグと同じ + if (d.breadLinks.indexOf(bread) == 0) { + breadChildElement.push({bread}); + } else { + breadChildElement.push({bread}); + } + } + breadElement = ( + + {breadChildElement} + + ); + } + // タグ部分を作成 + let tagElement = (タグ無し); + if (d.tags.length != 0) { + const tagChildElements: JSX.Element[] = []; + tagChildElements.push(タグ:); + for (const tag of d.tags) { + if (d.tags.indexOf(tag) != 0) { + tagChildElements.push(); + } + tagChildElements.push({tag}); + } + tagElement = ( + + {tagChildElements} + + ); + } + const hatebuElement = ( + + + + ); + return ( + + + + + + + ); + })} + +
+ No + + カテゴリ + + タイトル + + 日時 +
{d.articleId} + {topCategory} + +
{d.title}
+
+ 公式 + IA検索結果 + IAをiframe + {breadElement} + {tagElement} + {hatebuElement} +
+ {page2After} +
{timestampStr}
+ ); +} \ No newline at end of file -- cgit v1.2.3