Last active
January 3, 2024 13:48
-
-
Save kimshun0213kr/4a35b8533825b5ce98faf482b954dc06 to your computer and use it in GitHub Desktop.
/src/pages/login/indez.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Button, HStack, VStack } from "@chakra-ui/react"; | |
import { useState } from "react"; | |
import { UseLoginState } from "@/hooks/LoginState"; | |
export default function Main() { | |
const [InputId, setInputId] = useState(""); | |
const [InputPass, setInputPass] = useState(""); | |
const [isLogin, setIsLogin, setLogout] = UseLoginState(false); | |
function login() { | |
setIsLogin(InputId, InputPass); | |
} | |
return ( | |
<> | |
<HStack> | |
<VStack> | |
<p>IDを入力</p> | |
<input | |
placeholder="IDを入力" | |
onChange={(e) => setInputId(e.target.value)} | |
/> | |
</VStack> | |
<VStack> | |
<p>パスワードを入力</p> | |
<input | |
placeholder="パスワードを入力" | |
onChange={(e) => setInputPass(e.target.value)} | |
type="password" | |
/> | |
</VStack> | |
<Button onClick={login}>ログイン</Button> | |
</HStack> | |
{isLogin ? ( | |
<> | |
<h1>ログイン済み</h1> <Button onClick={setLogout}>ログアウト</Button> | |
</> | |
) : null} | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment