diff --git a/frontend/src/Attendance.jsx b/frontend/src/Attendance.jsx index 13dedd9..b45887c 100644 --- a/frontend/src/Attendance.jsx +++ b/frontend/src/Attendance.jsx @@ -1,9 +1,43 @@ +import { useState } from "react"; +import Header from "./components/Header"; +import InputBlock from "./components/InputBlock"; +import styles from "./Attendance.module.css"; + const Attendance = () => { + const [attendanceCode, setAttendanceCode] = useState([""]); + const handleChange = (index, value) => { + // 숫자만 입력 허용 + if (/^\d*$/.test(value)) { + const userCodes = [...attendanceCode]; + userCodes[index] = value; + setAttendanceCode(userCodes); + } + }; + const handleSubmit = () => { + console.log("제출된 출석 코드: ", attendanceCode[0]); + // 서버 요청 등 추가 작업 + }; + return ( -
-

Attendance

-

Attendance page content goes here.

+
+
+ + {attendanceCode[0].length === 4 && ( + + )}
); }; + export default Attendance; diff --git a/frontend/src/Attendance.module.css b/frontend/src/Attendance.module.css new file mode 100644 index 0000000..cebb0b5 --- /dev/null +++ b/frontend/src/Attendance.module.css @@ -0,0 +1,17 @@ +.attendance_page { + background-color: "black"; + height: "100vh"; + display: flex; + flex-direction: column; + align-items: center; + position: relative; +} +.submitBtn { + background-color: #ffffff; + opacity: 42%; + border-radius: 10px; + position: absolute; + top: 109px; + right: 63px; + padding: 7px; +} diff --git a/frontend/src/components/Header.jsx b/frontend/src/components/Header.jsx index 3b9d2a0..c9ec60e 100644 --- a/frontend/src/components/Header.jsx +++ b/frontend/src/components/Header.jsx @@ -1,35 +1,44 @@ -import React from 'react'; -import { useNavigate, useLocation } from 'react-router-dom'; -import { ArrowLeft, Wallet } from 'lucide-react'; -import './componentsCss/Header.css'; -import arrowIcon from '../assets/img/arrowicon.svg'; -import moneyIcon from '../assets/img/moneyicon.svg'; +import React from "react"; +import { useNavigate, useLocation } from "react-router-dom"; +import { ArrowLeft, Wallet } from "lucide-react"; +import "./componentsCss/Header.css"; +import arrowIcon from "../assets/img/arrowicon.svg"; +import moneyIcon from "../assets/img/moneyicon.svg"; const Header = () => { const navigate = useNavigate(); const location = useLocation(); const path = location.pathname; let title = "ATTENDANCE\nCHECK"; - if (path.includes('assignment')) title = "ASSIGNMENT\nCHECK"; - else if (path.includes('deposit')) title = "DEPOSIT"; + if (path.includes("assignment")) title = "ASSIGNMENT\nCHECK"; + else if (path.includes("deposit")) title = "DEPOSIT"; + else if (path.includes("attendance")) title = "ATTENDANCE\nCHECK"; - const showRightButton = !path.includes('deposit'); + const showRightButton = !path.includes("deposit"); return (
-

{title}

{showRightButton ? ( - ) : ( -
// 오른쪽 공백 유지 +
// 오른쪽 공백 유지 )}
); }; -export default Header; \ No newline at end of file +export default Header; diff --git a/frontend/src/components/InputBlock.jsx b/frontend/src/components/InputBlock.jsx index e4d515e..5caf6cc 100644 --- a/frontend/src/components/InputBlock.jsx +++ b/frontend/src/components/InputBlock.jsx @@ -1,7 +1,7 @@ import React from "react"; import "./componentsCss/InputBlock.css"; -const InputBlock = ({ inputs, onChange }) => { +const InputBlock = ({ inputs, onChange, values }) => { return (
{inputs.map((input, index) => ( @@ -10,6 +10,7 @@ const InputBlock = ({ inputs, onChange }) => { className="inputTag" type={input.type} placeholder={input.placeholder} + value={values[index] || ""} onChange={(e) => onChange && onChange(index, e.target.value)} /> ))}