Skip to content
Snippets Groups Projects
HomeMake.js 1.59 KiB
Newer Older
  • Learn to ignore specific revisions
  • Min Dong Hyeun's avatar
    Min Dong Hyeun committed
    import Input from "../components/Input";
    import Button from "../components/Button";
    import { useState } from "react";
    
    import { useNavigate } from "react-router-dom";
    
    Min Dong Hyeun's avatar
    Min Dong Hyeun committed
    import "../styles/HomeMake.css";
    
    function HomeMake() {
        const [title, setTitle] = useState("");
        const [password,setPassword] = useState("");
    
        const navigate = useNavigate();
    
    Min Dong Hyeun's avatar
    Min Dong Hyeun committed
    
        const onTitleChange = (event) => {
            setTitle(event.target.value);
        }
        const onPasswordChange = (event) => {
            setPassword(event.target.value);
        }
    
        const handleSubmit = (event)=>{
            event.preventDefault();
            if(title === ""){
                return alert("Title을 입력하세요");;
            }
            else if(password === ""){
                return alert("Password를 입력하세요");;
            }
            else{
                navigate("/MeetingInfo");
            }
        }
    
    Min Dong Hyeun's avatar
    Min Dong Hyeun committed
    
        return (
            <div className="center-container">
    
                <form onSubmit={handleSubmit}>
    
    Min Dong Hyeun's avatar
    Min Dong Hyeun committed
                <h1>When we meet?</h1>
                    <Input
                        type="text"
                        value={title}
                        onChange={onTitleChange}
                        placeholder="약속 Title"
                    />
                    <br />
                    <Input
                        type="text"
                        value={password}
                        onChange={onPasswordChange}
                        placeholder="관리용 Password"
                    />
                    <br/>
    
                    <Button
                        type="submit"
                        text="시작하기"
                    />
    
    Min Dong Hyeun's avatar
    Min Dong Hyeun committed
                </form>
            </div>
    
    Min Dong Hyeun's avatar
    Min Dong Hyeun committed
        );
    }
    
    export default HomeMake;