Skip to content

Commit f3e6f2c

Browse files
committed
topnavigationのdaisyUI移行を完了
1 parent d74640f commit f3e6f2c

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed
Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
1-
import { ArrowBack } from "@mui/icons-material";
2-
import { Box, IconButton, Typography } from "@mui/material";
31
import Link from "next/link";
2+
import { MdOutlineArrowBack } from "react-icons/md";
3+
4+
type TopNavigationProps = {
5+
title: string;
6+
};
47

58
/**
69
* Settings の子ページから Setting に戻るナビゲーションを提供
710
*/
8-
export default function TopNavigation({ title }: { title: string }) {
11+
export default function TopNavigation({ title }: TopNavigationProps) {
912
return (
10-
<Box
11-
py={1}
12-
sx={{
13-
display: "flex",
14-
alignItems: "center",
15-
// 主に profile ページ向け。calc(画面縦幅 - カード縦幅 - ヘッダー幅 - ボトムナビ幅 - ページの py - 編集ボタンの高さ)。
13+
<div
14+
className="flex items-center py-2"
15+
style={{
16+
// Main profile-specific styling for dynamic height calculation
1617
height: "min(56px, calc(100dvh - 70dvh - 56px - 56px - 16px - 36px))",
1718
}}
1819
>
19-
<IconButton LinkComponent={Link} href="/settings">
20-
<ArrowBack />
21-
</IconButton>
22-
<Typography
23-
variant="h5"
24-
component="h1"
25-
sx={{
26-
fontWeight: "bold",
27-
// タイトルを中央に寄せる。矢印が左にしかないため。
28-
position: "absolute",
29-
left: "50%",
30-
transform: "translateX(-50%)",
31-
overflow: "hidden",
32-
whiteSpace: "nowrap",
33-
textOverflow: "ellipsis",
20+
<Link href="/settings" passHref>
21+
{/* biome-ignore lint/a11y/useButtonType: <explanation> */}
22+
<button className="btn btn-ghost btn-circle">
23+
<MdOutlineArrowBack size={24} />
24+
</button>
25+
</Link>
26+
<h1
27+
className="-translate-x-1/2 absolute left-1/2 transform overflow-hidden text-ellipsis whitespace-nowrap font-bold text-lg"
28+
style={{
29+
// Center-align the title text due to the left-only arrow
30+
maxWidth: "calc(100% - 64px)", // Prevents the title from overflowing the arrow button
3431
}}
3532
>
3633
{title}
37-
</Typography>
38-
</Box>
34+
</h1>
35+
</div>
3936
);
4037
}

0 commit comments

Comments
 (0)