Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻ :: MajorLine 컴포넌트 분리 #39

Merged
merged 24 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SOPOLAST/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/styled-components": "^5.1.34",
"axios": "^1.6.5",
"axios": "^1.6.7",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

axios 원래 버전으로 바꿔주세요 1.6.5버전

"browser": "^0.2.6",
"cli": "^1.0.1",
"css-loader": "^6.9.0",
Expand Down
29 changes: 23 additions & 6 deletions SOPOLAST/src/constants/MajorLine/Major.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import * as S from "src/constants/MajorLine/Major.style";
import axios from "axios";

export default function Major() {
const [activeIndex, setActiveIndex] = useState(null);
const [grades, setGrades] = useState([]);
const navigate = useNavigate();

useEffect(() => {
const fetchData = async () => {
try {
const response = await axios.get("히히api자리지롱");
setGrades(response.data);
} catch (error) {
console.error("Error fetching data:", error);
}
};

fetchData();
}, []);

const handleClick = (index:string) => {
setActiveIndex(index);
Expand All @@ -12,12 +28,13 @@ export default function Major() {
return (
<div className="main">
<div className="content">
{/* 스타일을 적용한 요소들을 렌더링합니다. */}
<S.StackLine>
<S.GradeSelect className="gradeSelect">
<option value="8">8기</option>
<option value="7">7기</option>
<option value="6">6기</option>
<S.GradeSelect className="gradeSelect">
{grades.map((grade) => (
<option key={grade.id} value={grade.id}>
{grade.name}
</option>
))}
</S.GradeSelect>

<S.GradeGreen> | </S.GradeGreen>
Expand Down