Skip to content

Commit a1c3f5a

Browse files
committed
style修正
1 parent eed771b commit a1c3f5a

File tree

1 file changed

+33
-28
lines changed

1 file changed

+33
-28
lines changed

web/app/home/page.tsx

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import CloseIcon from "@mui/icons-material/Close";
44
import FavoriteIcon from "@mui/icons-material/Favorite";
5+
import { motion, useAnimation } from "framer-motion";
56
import { useCallback, useEffect, useState } from "react";
67
import request from "~/api/request";
7-
import { motion, useAnimation } from "framer-motion";
88
import { useMyID, useRecommended } from "~/api/user";
99
import { Card } from "~/components/Card";
1010
import { DraggableCard } from "~/components/DraggableCard";
@@ -79,31 +79,34 @@ export default function Home() {
7979

8080
return (
8181
<NavigateByAuthState type="toLoginForUnauthenticated">
82-
<div className="h-full flex flex-col justify-center items-center">
82+
<div className="flex h-full flex-col items-center justify-center">
8383
{displayedUser && (
84-
<div className="h-full flex flex-col justify-center items-center">
85-
{nextUser && (
86-
<div className="relative w-full h-full">
87-
<div className="absolute inset-0 z-0 mt-4 transform -translate-x-1/2">
88-
<Card displayedUser={nextUser} />
84+
<div className="flex h-full flex-col items-center justify-center">
85+
{nextUser && (
86+
<div className="relative h-full w-full">
87+
<div className="-translate-x-1/2 absolute inset-0 z-0 mt-4 transform">
88+
<Card displayedUser={nextUser} />
89+
</div>
90+
<motion.div
91+
animate={controls}
92+
className="absolute inset-0 z-10 mt-4 flex items-center justify-center"
93+
>
94+
<DraggableCard
95+
displayedUser={displayedUser}
96+
comparisonUserId={myId || undefined}
97+
onSwipeLeft={reject}
98+
onSwipeRight={accept}
99+
clickedButton={clickedButton}
100+
/>
101+
</motion.div>
89102
</div>
90-
<motion.div
91-
animate={controls}
92-
className="absolute inset-0 z-10 flex justify-center items-center mt-4"
93-
>
94-
<DraggableCard
95-
displayedUser={displayedUser}
96-
comparisonUserId={myId || undefined}
97-
onSwipeLeft={reject}
98-
onSwipeRight={accept}
99-
clickedButton={clickedButton}
100-
/>
101-
</motion.div>
102-
</div>
103-
)}
104-
<div className="flex w-full mb-4 mt-4 space-x-8 button-container">
103+
)}
104+
<div className="button-container mt-4 mb-4 flex w-full space-x-8">
105105
<RoundButton onclick={onClickCross} icon={<CloseIconStyled />} />
106-
<RoundButton onclick={onClickHeart} icon={<FavoriteIconStyled />} />
106+
<RoundButton
107+
onclick={onClickHeart}
108+
icon={<FavoriteIconStyled />}
109+
/>
107110
</div>
108111
</div>
109112
)}
@@ -118,15 +121,17 @@ interface RoundButtonProps {
118121
}
119122

120123
const RoundButton = ({ onclick, icon }: RoundButtonProps) => (
121-
<button onClick={onclick} className="btn btn-circle shadow-md bg-white">
124+
<button
125+
type="button"
126+
onClick={onclick}
127+
className="btn btn-circle bg-white shadow-md"
128+
>
122129
{icon}
123130
</button>
124131
);
125132

126-
const CloseIconStyled = () => (
127-
<CloseIcon className="text-gray-500 text-4xl" />
128-
);
133+
const CloseIconStyled = () => <CloseIcon className="text-4xl text-gray-500" />;
129134

130135
const FavoriteIconStyled = () => (
131-
<FavoriteIcon className="text-red-500 text-4xl" />
136+
<FavoriteIcon className="text-4xl text-red-500" />
132137
);

0 commit comments

Comments
 (0)