Skip to content

Commit

Permalink
feat: SignUp/Logoutでコンポーネントを使用するように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
shun-shobon committed Oct 21, 2024
1 parent c7ead40 commit c24bbe7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
10 changes: 3 additions & 7 deletions app/routes/_index/SignUp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ReactNode } from "react";
import { type SubmitHandler, useForm } from "react-hook-form";
import { Button } from "~/components/Button";
import { Input } from "~/components/Input";
import { supabase } from "~/libs/supabase";

interface FormData {
Expand All @@ -26,14 +27,9 @@ export function SignUp(): ReactNode {
return (
<form
onSubmit={handleSubmit(onSubmit)}
className="grid justify-items-center gap-2"
className="grid justify-items-center gap-4"
>
<input
type="text"
className="w-full rounded-lg border border-gray-300 px-4 py-2"
placeholder="名前"
{...register("displayName")}
/>
<Input placeholder="名前" {...register("displayName")} />
<Button type="submit">登録</Button>
</form>
);
Expand Down
9 changes: 2 additions & 7 deletions app/routes/_index/route.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { MetaFunction } from "@remix-run/node";
import { Button } from "~/components/Button";
import { Heading } from "~/components/Heading";
import { useMyProfile } from "~/features/profile/useMyProfile";
import { supabase } from "~/libs/supabase";
Expand Down Expand Up @@ -32,13 +33,7 @@ export default function Page() {
<div>Play Count: {myProfile.playCount}</div>
<div>High Score: {myProfile.highScore ?? "-"}</div>
<div>Rank: {myProfile.rank ?? "-"}</div>
<button
type="button"
onClick={handleLogout}
className="rounded-lg bg-pink-500 px-4 py-2 text-center font-bold text-white"
>
Logout
</button>
<Button onClick={handleLogout}>Logout</Button>
</div>
) : (
<SignUp />
Expand Down

0 comments on commit c24bbe7

Please sign in to comment.