|
1 | 1 | "use client"; |
2 | 2 |
|
3 | | -import { Tab, Tabs } from "@mui/material"; |
4 | | -import { useState } from "react"; |
5 | 3 | import { NavigateByAuthState } from "~/components/common/NavigateByAuthState"; |
6 | 4 | import Matchings from "~/components/match/matching"; |
7 | 5 | import Requests from "~/components/match/requests"; |
8 | 6 |
|
9 | 7 | export default function Friends() { |
10 | | - const [open, setOpen] = useState(0); |
11 | | - |
12 | | - const handleChange = (_event: React.SyntheticEvent, newOpen: number) => { |
13 | | - setOpen(newOpen); |
14 | | - }; |
15 | | - |
16 | 8 | return ( |
17 | 9 | <NavigateByAuthState type="toLoginForUnauthenticated"> |
18 | | - <div className="fixed z-50 w-full border-gray-200 border-b-[1px] bg-white"> |
19 | | - <Tabs value={open} onChange={handleChange} variant="fullWidth"> |
20 | | - <Tab label="マッチ中" {...a11yProps(0)} sx={{ width: "50%" }} /> |
21 | | - <Tab label="リクエスト" {...a11yProps(1)} sx={{ width: "50%" }} /> |
22 | | - </Tabs> |
23 | | - </div> |
24 | | - <div className="absolute top-9 right-0 left-0 overflow-y-auto"> |
25 | | - <TabPanel open={open}> |
26 | | - {open === 0 ? <Matchings /> : open === 1 ? <Requests /> : null} |
27 | | - </TabPanel> |
| 10 | + {/* biome-ignore lint/a11y/useSemanticElements: <explanation> */} |
| 11 | + <div role="tablist" className="tabs tabs-bordered w-full"> |
| 12 | + <input |
| 13 | + type="radio" |
| 14 | + name="my_tabs_1" |
| 15 | + role="tab" |
| 16 | + className="tab" |
| 17 | + aria-label="マッチ中" |
| 18 | + defaultChecked |
| 19 | + /> |
| 20 | + {/* biome-ignore lint/a11y/useSemanticElements: <explanation> */} |
| 21 | + <div role="tabpanel" className="tab-content p-10 "> |
| 22 | + <Matchings /> |
| 23 | + </div> |
| 24 | + |
| 25 | + <input |
| 26 | + type="radio" |
| 27 | + name="my_tabs_1" |
| 28 | + role="tab" |
| 29 | + className="tab" |
| 30 | + aria-label="リクエスト" |
| 31 | + /> |
| 32 | + {/* biome-ignore lint/a11y/useSemanticElements: <explanation> */} |
| 33 | + <div role="tabpanel" className="tab-content p-10"> |
| 34 | + <Requests /> |
| 35 | + </div> |
28 | 36 | </div> |
29 | 37 | </NavigateByAuthState> |
30 | 38 | ); |
31 | 39 | } |
32 | | - |
33 | | -function TabPanel({ |
34 | | - open, |
35 | | - children, |
36 | | -}: { |
37 | | - open: number; |
38 | | - children: React.ReactNode; |
39 | | -}) { |
40 | | - return ( |
41 | | - <div |
42 | | - // role="tabpanel" // FIXME: biome says it should not be a div, but I couldn't find a proper html elem |
43 | | - id={`tabpanel-${open}`} |
44 | | - aria-labelledby={`tab-${open}`} |
45 | | - > |
46 | | - <div>{children}</div> |
47 | | - </div> |
48 | | - ); |
49 | | -} |
50 | | - |
51 | | -function a11yProps(index: number) { |
52 | | - return { |
53 | | - id: `tab-${index}`, |
54 | | - "aria-controls": `tabpanel-${index}`, |
55 | | - }; |
56 | | -} |
0 commit comments