|
1 | | -import { ArrowBack } from "@mui/icons-material"; |
2 | | -import { Box, IconButton, Typography } from "@mui/material"; |
3 | 1 | import Link from "next/link"; |
| 2 | +import { MdOutlineArrowBack } from "react-icons/md"; |
| 3 | + |
| 4 | +type TopNavigationProps = { |
| 5 | + title: string; |
| 6 | +}; |
4 | 7 |
|
5 | 8 | /** |
6 | 9 | * Settings の子ページから Setting に戻るナビゲーションを提供 |
7 | 10 | */ |
8 | | -export default function TopNavigation({ title }: { title: string }) { |
| 11 | +export default function TopNavigation({ title }: TopNavigationProps) { |
9 | 12 | 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 |
16 | 17 | height: "min(56px, calc(100dvh - 70dvh - 56px - 56px - 16px - 36px))", |
17 | 18 | }} |
18 | 19 | > |
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 |
34 | 31 | }} |
35 | 32 | > |
36 | 33 | {title} |
37 | | - </Typography> |
38 | | - </Box> |
| 34 | + </h1> |
| 35 | + </div> |
39 | 36 | ); |
40 | 37 | } |
0 commit comments