Skip to content

Commit f159108

Browse files
authored
細かいDaisyUI移行を実行 (#526)
# PRの概要 ## 具体的な変更内容 ## 影響範囲 ## 動作要件 ## 補足 ## レビューリクエストを出す前にチェック! - [ ] 改めてセルフレビューしたか - [ ] 手動での動作検証を行ったか - [ ] server の機能追加ならば、テストを書いたか - 理由: 書いた | server の機能追加ではない - [ ] 間違った使い方が存在するならば、それのドキュメントをコメントで書いたか - 理由: 書いた | 間違った使い方は存在しない - [ ] わかりやすいPRになっているか <!-- レビューリクエスト後は、Slackでもメンションしてお願いすることを推奨します。 -->
1 parent 2f44a82 commit f159108

20 files changed

+394
-633
lines changed

web/app/home/layout.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Box } from "@mui/material";
21
import BottomBar from "~/components/BottomBar";
32
import Header from "~/components/Header";
43

@@ -10,21 +9,9 @@ export default function HomePageLayout({
109
return (
1110
<>
1211
<Header title="ホーム/Home" />
13-
<Box
14-
sx={{
15-
position: "absolute", // TODO: absolute 指定しない
16-
top: {
17-
xs: "56px",
18-
sm: "64px",
19-
},
20-
bottom: "56px",
21-
left: 0,
22-
right: 0,
23-
overflowY: "auto",
24-
}}
25-
>
12+
<div className="relative top-14 right-0 bottom-14 left-0 overflow-y-auto sm:top-16">
2613
{children}
27-
</Box>
14+
</div>
2815
<BottomBar activeTab="0_home" />
2916
</>
3017
);

web/app/login/page.tsx

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22

3-
import { Box, Button, Link, Typography } from "@mui/material";
43
import { GoogleAuthProvider, signInWithPopup } from "firebase/auth";
54
import { useRouter } from "next/navigation";
65
import { useSnackbar } from "notistack";
@@ -125,34 +124,21 @@ export default function Login() {
125124
return (
126125
<NavigateByAuthState type="toHomeForAuthenticated">
127126
<Header title="CourseMate" />
128-
<Box
129-
sx={{
130-
position: "absolute",
131-
top: "56px",
132-
bottom: 0,
133-
left: 0,
134-
right: 0,
135-
overflowY: "auto",
136-
display: "flex",
137-
flexDirection: "column",
138-
alignItems: "center",
139-
justifyContent: "space-around",
140-
}}
141-
>
142-
<Box textAlign="center">
127+
<div className="absolute top-14 right-0 bottom-0 left-0 flex flex-col items-center justify-around overflow-y-auto">
128+
<div className="text-center">
143129
<CourseMateIcon width="200px" height="200px" />
144-
</Box>
145-
<Box textAlign="left">
146-
<Typography variant="h4">
130+
</div>
131+
<div className="text-left">
132+
<h1 className="font-semibold text-3xl">
147133
CourseMateを使って
148134
<br />
149135
同じ授業の人と
150136
<br />
151137
友達になろう
152-
</Typography>
153-
</Box>
138+
</h1>
139+
</div>
154140

155-
<Box sx={{ width: "80%" }} textAlign="center">
141+
<div className="w-4/5 text-center">
156142
<button
157143
className="gsi-material-button"
158144
onClick={logInByGoogle}
@@ -219,16 +205,15 @@ export default function Login() {
219205
</div>
220206
</button>
221207
<br />
222-
<Link
223-
component={Button}
208+
<button
209+
type="button"
224210
onClick={singUpByGoogle}
225-
mt={2}
226-
underline="none"
211+
className="mt-2 text-blue-600 hover:underline"
227212
>
228213
初めての方はこちら
229-
</Link>
230-
</Box>
231-
</Box>
214+
</button>
215+
</div>
216+
</div>
232217
</NavigateByAuthState>
233218
);
234219
}

web/app/signup/page.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22

3-
import { Box } from "@mui/material";
43
import { useSnackbar } from "notistack";
54
import { useState } from "react";
65

@@ -78,19 +77,10 @@ function Registration() {
7877
export default function RegistrationPage() {
7978
return (
8079
<NavigateByAuthState type="toHomeForAuthenticated">
81-
<Box
82-
sx={{
83-
position: "absolute",
84-
top: "56px",
85-
bottom: 0,
86-
left: 0,
87-
right: 0,
88-
overflowY: "auto",
89-
}}
90-
>
80+
<div className="absolute top-14 right-0 bottom-0 left-0 overflow-y-auto">
9181
<Header title="登録/Register" />
9282
<Registration />
93-
</Box>
83+
</div>
9484
</NavigateByAuthState>
9585
);
9686
}

web/app/tutorial/page.tsx

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22

3-
import { Box, Typography } from "@mui/material";
43
import { Navigation, Pagination } from "swiper/modules";
54
import { Swiper, SwiperSlide } from "swiper/react";
65
import "swiper/css";
@@ -42,68 +41,36 @@ const tutorialSteps = [
4241

4342
export default function Tutorial() {
4443
return (
45-
<Box
46-
sx={{
47-
padding: "20px",
48-
display: "flex",
49-
flexDirection: "column",
50-
position: "absolute",
51-
top: "56px",
52-
bottom: 0,
53-
left: 0,
54-
right: 0,
55-
overflowY: "auto",
56-
}}
57-
>
44+
<div className="absolute inset-0 flex flex-col overflow-y-auto px-5 pt-14">
5845
<Header title="チュートリアル/Tutorial" />
59-
<Box
60-
sx={{
61-
textAlign: "left",
62-
}}
63-
>
46+
<div className="text-left">
6447
<Swiper
6548
modules={[Navigation, Pagination]}
6649
spaceBetween={50}
6750
slidesPerView={1}
6851
navigation
6952
pagination={{ clickable: true }}
70-
style={{
71-
paddingBottom: "60px",
72-
}}
53+
className="pb-16"
7354
>
7455
{tutorialSteps.map((step) => (
7556
<SwiperSlide key={step.imgPath}>
76-
<Box sx={{ textAlign: "center", mb: "24px" }}>
77-
<Typography
78-
variant="h6"
79-
component="h1"
80-
gutterBottom
81-
sx={{ fontWeight: "bold", mb: "16px" }}
82-
>
83-
{step.label}
84-
</Typography>
57+
<div className="mb-6 text-center">
58+
<h1 className="mb-4 font-bold text-lg">{step.label}</h1>
8559
<img
8660
src={step.imgPath}
8761
alt={step.label}
88-
style={{
89-
display: "block",
90-
width: "60vw",
91-
height: "calc(60vw·*·(667·/·375))",
92-
maxWidth: 400,
93-
overflow: "hidden",
94-
margin: "auto",
95-
}}
62+
className="mx-auto block h-auto w-[60vw] max-w-[400px]"
9663
/>
97-
</Box>
64+
</div>
9865
</SwiperSlide>
9966
))}
10067
</Swiper>
101-
<Box sx={{ textAlign: "center" }}>
68+
<div className="text-center">
10269
<Link href="/home" className="btn btn-primary w-full">
10370
ホーム画面へ
10471
</Link>
105-
</Box>
106-
</Box>
107-
</Box>
72+
</div>
73+
</div>
74+
</div>
10875
);
10976
}

web/components/Header.tsx

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
2-
import { AppBar, Box, IconButton, Toolbar, Typography } from "@mui/material";
31
import Link from "next/link";
2+
import { MdInfoOutline } from "react-icons/md";
43
import { CourseMateIcon } from "./common/CourseMateIcon";
54

65
type Props = {
@@ -10,32 +9,20 @@ type Props = {
109
export default function Header(props: Props) {
1110
const { title } = props;
1211
return (
13-
<>
14-
<AppBar
15-
position="fixed"
16-
sx={{
17-
backgroundColor: "secondary.main",
18-
boxShadow: "2px 2px 4px -2px gray",
19-
}}
20-
>
21-
<Toolbar>
22-
<Box sx={{ marginRight: "8px" }}>
23-
<IconButton LinkComponent={Link} href="/home">
24-
<CourseMateIcon width="28px" height="28px" />
25-
</IconButton>
26-
</Box>
27-
<Typography
28-
variant="h6"
29-
component="h2"
30-
sx={{ flexGrow: 1, color: "#000000" }}
31-
>
32-
{title}
33-
</Typography>
34-
<IconButton LinkComponent={Link} href="/faq" sx={{ zIndex: "100" }}>
35-
<InfoOutlinedIcon />
36-
</IconButton>
37-
</Toolbar>
38-
</AppBar>
39-
</>
12+
<header className="fixed top-0 left-0 z-50 w-full bg-secondary shadow-md">
13+
<div className="flex items-center justify-between px-4 py-2">
14+
<Link href="/home" passHref>
15+
<CourseMateIcon width="28px" height="28px" />
16+
</Link>
17+
18+
<h1 className="flex-grow text-center font-semibold text-black text-lg">
19+
{title}
20+
</h1>
21+
22+
<Link href="/faq" passHref>
23+
<MdInfoOutline size={24} />
24+
</Link>
25+
</div>
26+
</header>
4027
);
4128
}

web/components/ImageCropper.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Slider } from "@mui/material";
21
import { useState } from "react";
32
import Cropper from "react-easy-crop";
43

@@ -11,6 +10,10 @@ export function ImageCropper({ sameOriginURL: url, onImageChange }: Props) {
1110
const [crop, setCrop] = useState({ x: 0, y: 0 });
1211
const [zoom, setZoom] = useState(1);
1312

13+
const handleSliderChange = (event: React.ChangeEvent<HTMLInputElement>) => {
14+
setZoom(Number(event.target.value));
15+
};
16+
1417
return (
1518
<>
1619
<div
@@ -39,16 +42,19 @@ export function ImageCropper({ sameOriginURL: url, onImageChange }: Props) {
3942
}}
4043
/>
4144
</div>
42-
<Slider
43-
value={zoom}
44-
min={1}
45-
max={3}
46-
step={0.05}
47-
aria-labelledby="Zoom Level"
48-
onChange={(_, newVal) => {
49-
setZoom(Number(newVal) || 1);
50-
}}
51-
/>
45+
<div className="mt-4 flex items-center">
46+
<input
47+
id="zoom"
48+
type="range"
49+
className="range range-secondary"
50+
min={1}
51+
max={3}
52+
step={0.05}
53+
value={zoom}
54+
onChange={handleSliderChange}
55+
/>
56+
<span className="ml-2 text-sm">{zoom.toFixed(2)}</span>
57+
</div>
5258
</>
5359
);
5460
}

web/components/chat/MessageInput.tsx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import SendIcon from "@mui/icons-material/Send";
2-
import { Box, IconButton, Stack, TextField, Typography } from "@mui/material";
31
import { useEffect, useState } from "react";
2+
import { MdSend } from "react-icons/md";
43
import type { DMOverview, SendMessage, UserID } from "~/common/types";
54
import { parseContent } from "~/common/zod/methods";
65

@@ -58,34 +57,30 @@ export function MessageInput({ send, room }: Props) {
5857
}
5958

6059
return (
61-
<Box sx={{ padding: "0px" }}>
60+
<div className="p-0">
6261
<form onSubmit={submit}>
63-
<Stack direction="row" spacing={1} alignItems="center" margin={2}>
64-
<TextField
62+
<div className="flex items-center space-x-2 p-2">
63+
<textarea
6564
name="message"
6665
placeholder="メッセージを入力"
67-
variant="outlined"
68-
size="small"
66+
className={`textarea textarea-bordered w-full resize-none ${
67+
error ? "textarea-error" : ""
68+
}`}
6969
value={message}
70-
fullWidth
71-
multiline
72-
minRows={1}
73-
maxRows={3}
70+
rows={1}
7471
onChange={(e) => setMessage(e.target.value)}
7572
onKeyDown={handleKeyDown}
76-
error={!!error}
7773
autoComplete="off"
7874
/>
79-
<IconButton type="submit" color="primary">
80-
<SendIcon />
81-
</IconButton>
82-
</Stack>
83-
{error && (
84-
<Typography color="error" variant="body2" marginLeft={2}>
85-
{error}
86-
</Typography>
87-
)}
75+
<button
76+
type="submit"
77+
className="btn btn-primary btn-circle flex items-center justify-center"
78+
>
79+
<MdSend />
80+
</button>
81+
</div>
82+
{error && <p className="ml-2 text-red-500 text-sm">{error}</p>}
8883
</form>
89-
</Box>
84+
</div>
9085
);
9186
}

0 commit comments

Comments
 (0)