diff --git a/src/components/Todo/AddTodo.tsx b/src/components/Todo/AddTodo.tsx index c9ed5ed..e93ac64 100644 --- a/src/components/Todo/AddTodo.tsx +++ b/src/components/Todo/AddTodo.tsx @@ -9,19 +9,21 @@ import { } from "@mui/material"; import Image from "next/image"; import { useState } from "react"; +import { CustomButton } from "../common/CustomButton"; import DatePick from "../common/DatePick"; export default function AddTodo() { const [isOpen, setIsOpen] = useState(false); return (
- + primaryColor="#C5956B" + secondaryColor="#C37349" + buttonName="Open" + /> setIsOpen(false)} diff --git a/src/components/common/CustomButton.tsx b/src/components/common/CustomButton.tsx index 620c5f6..b79f4c5 100644 --- a/src/components/common/CustomButton.tsx +++ b/src/components/common/CustomButton.tsx @@ -1,59 +1,183 @@ -import { Box, Button, CircularProgress, Typography } from "@mui/material"; +import { + Box, + Button, + ButtonProps, + CircularProgress, + Typography, +} from "@mui/material"; -export const CustomButton = ({ buttonName }: { buttonName: string }) => { +export const CustomButton = ( + props: { + buttonName: string; + primaryColor: string; + secondaryColor: string; + } & ButtonProps +) => { return ( - + + { opacity: 0.5, width: 0, height: 0, - left: 24, - top: -5, - zIndex: -5, - }} - /> - - ・ω・ - - {buttonName} - - - + ); }; diff --git a/src/components/schedule/ScheduleCalender.tsx b/src/components/schedule/ScheduleCalender.tsx index b67e16e..e7196cb 100644 --- a/src/components/schedule/ScheduleCalender.tsx +++ b/src/components/schedule/ScheduleCalender.tsx @@ -1,7 +1,7 @@ import { Schedule } from "@/types/schema"; import dayGridPlugin from "@fullcalendar/daygrid"; import FullCalendar from "@fullcalendar/react"; -import { Button, Paper, Typography } from "@mui/material"; +import { Paper, Typography } from "@mui/material"; import axios from "axios"; import { useEffect, useState } from "react"; import { CustomDate } from "../common/CustomDate"; @@ -50,11 +50,6 @@ export const ScheduleCalendar = () => { padding: 2, }} > - {schedule?.title} 開始: diff --git a/src/pages/signin.tsx b/src/pages/signin.tsx index e1e4cea..32ec163 100644 --- a/src/pages/signin.tsx +++ b/src/pages/signin.tsx @@ -1,112 +1,100 @@ - -import React, { ChangeEvent, useState } from "react"; -import { - Box, - Button, - Paper, - Stack, - TextField, - Typography, -} from "@mui/material"; -import { SigninUser } from "../types/schema"; +import { CustomButton } from "@/components/common/CustomButton"; +import { Box, Paper, Stack, TextField, Typography } from "@mui/material"; import axios from "axios"; import { useRouter } from "next/router"; +import { ChangeEvent, useState } from "react"; +import { SigninUser } from "../types/schema"; const Signin = () => { - const router = useRouter(); - const handleChange = (event: ChangeEvent) => { - setUserInput({ ...userInput, [event.target.name]: event.target.value }); - }; - const [userInput, setUserInput] = useState({ - email: "", - password: "", - }); - const handleSubmit = () => { - if (userInput.email === "") { - return; - } else if (userInput.password === "") { - return; - } - handleSignIn(); - }; + const router = useRouter(); + const handleChange = (event: ChangeEvent) => { + setUserInput({ ...userInput, [event.target.name]: event.target.value }); + }; + const [userInput, setUserInput] = useState({ + email: "", + password: "", + }); + const handleSubmit = () => { + if (userInput.email === "") { + return; + } else if (userInput.password === "") { + return; + } + handleSignIn(); + }; + + const handleSignIn = async () => { + try { + const response = await axios.post( + `${process.env.NEXT_PUBLIC_BACKEND_URL}/api/v1/users/signin`, + userInput + ); - const handleSignIn = async () => { - try { - const response = await axios.post( - `${process.env.NEXT_PUBLIC_BACKEND_URL}/api/v1/users/signin`, - userInput - ); - - if (response.status == 200) { - localStorage.setItem("jwt", response.data.jwt); - router.push("/todo"); - } - } catch (error) { - console.log(error); - } - }; - return ( - - - - SIGN IN - - - - - - - - - - - - - - - ); + > + + SIGN IN + + + + + + + + + + + + + ); }; export default Signin;