Skip to content

Commit a3af445

Browse files
authored
Home画面のcssを修正 (#393)
<!--変更したい場合は、`/.github/pull_request_template.md` を修正して下さい。--> # PRの概要 Home画面のcssを修正しました。 <!-- 変更の目的 もしくは 関連する Issue 番号 --> <!-- 以下のように書くと Issue にリンクでき、マージ時に自動で Issue を閉じられる--> <!-- closes #1 --> close #374 ## 具体的な変更内容 <!-- ビューの変更がある場合はスクショによる比較などがあるとわかりやすい --> - ボタンサイズを大きくした - 背景の切れていた部分の修正 - カードのwidthを大きくした - カードのスワイプのthresholdを減少させた https://github.com/user-attachments/assets/81875c78-3370-4081-8c26-be5ee90320a5 ## 影響範囲 <!-- この関数を変更したのでこの機能にも影響がある、など --> とくになし ## 動作要件 <!-- 動作に必要な 環境変数 / 依存関係 / DBの更新 など --> とくになし ## 補足 <!-- レビューをする際に見てほしい点、ローカル環境で試す際の注意点、など --> ブラウザ版横長画面のボタンが結構デカい ## レビューリクエストを出す前にチェック! - [x] 改めてセルフレビューしたか - [x] 手動での動作検証を行ったか - [x] server の機能追加ならば、テストを書いたか - 理由: 書いた | server の機能追加ではない - [x] 間違った使い方が存在するならば、それのドキュメントをコメントで書いたか - 理由: 書いた | 間違った使い方は存在しない - [x] わかりやすいPRになっているか <!-- レビューリクエスト後は、Slackでもメンションしてお願いすることを推奨します。 -->
1 parent eed497a commit a3af445

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

web/src/components/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function Card({ displayedUser, onFlip }: CardProps) {
3838
<div
3939
style={{
4040
perspective: "1000px",
41-
width: "70vw",
41+
width: "85vw",
4242
height: "70vh",
4343
position: "relative",
4444
}}

web/src/components/DraggableCard.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useCallback, useState } from "react";
33
import type { User } from "../common/types";
44
import { Card } from "./Card";
55

6-
const SWIPE_THRESHOLD = 200;
6+
const SWIPE_THRESHOLD = 125;
77

88
interface DraggableCardProps {
99
displayedUser: User;
@@ -57,7 +57,9 @@ export const DraggableCard = ({
5757
}, [dragX, dragY, onSwipeRight, onSwipeLeft]);
5858

5959
return (
60-
<section style={{ pointerEvents: dragging ? "none" : undefined }}>
60+
<section
61+
style={{ pointerEvents: dragging ? "none" : undefined, height: "100%" }}
62+
>
6163
<motion.div
6264
drag
6365
dragElastic={0.9}

web/src/routes/tabs/home.tsx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,22 @@ export default function Home() {
9898
}
9999

100100
return (
101-
<div style={{ backgroundColor: getBackgroundColor(dragValue) }}>
101+
<div
102+
style={{
103+
backgroundColor: getBackgroundColor(dragValue),
104+
height: "100%",
105+
display: "flex",
106+
flexDirection: "column",
107+
justifyContent: "center",
108+
}}
109+
>
102110
{displayedUser ? (
103-
<Box display="flex" flexDirection="column" alignItems="center">
111+
<Box
112+
display="flex"
113+
flexDirection="column"
114+
alignItems="center"
115+
height="100%"
116+
>
104117
<DraggableCard
105118
displayedUser={displayedUser}
106119
onSwipeLeft={handleReject}
@@ -113,7 +126,9 @@ export default function Home() {
113126
flexDirection: "row",
114127
alignItems: "center",
115128
justifyContent: "space-around",
116-
width: "50%",
129+
width: "100%",
130+
height: "100%",
131+
marginBottom: "10px",
117132
}}
118133
>
119134
<RoundButton onclick={handleReject} icon={<CloseIconStyled />} />
@@ -144,17 +159,16 @@ const RoundButton = ({ onclick, icon }: RoundButtonProps) => {
144159

145160
const ButtonStyle = {
146161
borderRadius: "50%",
147-
width: "7vw",
148-
height: "auto",
149-
margin: "10px",
162+
width: "15vw",
163+
height: "15vw",
150164
boxShadow: shadows[10],
151165
backgroundColor: "white",
152166
};
153167

154168
const CloseIconStyled = () => {
155-
return <CloseIcon style={{ color: "grey", fontSize: "5vw" }} />;
169+
return <CloseIcon style={{ color: "grey", fontSize: "10vw" }} />;
156170
};
157171

158172
const FavoriteIconStyled = () => {
159-
return <FavoriteIcon style={{ color: "red", fontSize: "5vw" }} />;
173+
return <FavoriteIcon style={{ color: "red", fontSize: "10vw" }} />;
160174
};

0 commit comments

Comments
 (0)