1
1
import styled from "styled-components" ;
2
2
import { Column , Row } from "@/components/Flex" ;
3
3
import { theme , font , flex } from "@/styles" ;
4
+ import { useSetAtom } from "jotai" ;
5
+ import { studentNumberContext , buttonSwitchContext } from "../context" ;
6
+ import { getStudentId } from "../helpers" ;
4
7
5
8
interface MeisterProfileBoxProps {
6
9
score : number ;
@@ -22,24 +25,31 @@ const RankingListItem = ({
22
25
negativePoint,
23
26
index,
24
27
} : MeisterProfileBoxProps ) => {
28
+ const { grade, classNo, studentNo } = student ;
29
+ const setStudentNum = useSetAtom ( studentNumberContext ) ;
30
+ const setSwitch = useSetAtom ( buttonSwitchContext ) ;
31
+
32
+ const handleContainerButtonClick = ( ) => {
33
+ setStudentNum ( getStudentId ( grade , classNo , studentNo ) ) ;
34
+ setSwitch ( true ) ;
35
+ } ;
36
+
25
37
return (
26
- < Container >
38
+ < Container onClick = { handleContainerButtonClick } >
27
39
< RankText > { index } </ RankText >
28
40
< Column >
29
41
< Row alignItems = "center" gap = "5px" >
30
42
< Department >
31
- { student . grade >= 2 ? (
32
- < span >
33
- { student . classNo <= 2 ? "소프트웨어" : "임베디드소프트웨어" }
34
- </ span >
43
+ { grade >= 2 ? (
44
+ < span > { classNo <= 2 ? "소프트웨어" : "임베디드소프트웨어" } </ span >
35
45
) : (
36
46
"통합"
37
47
) }
38
48
개발과
39
49
</ Department >
40
- < Grade > { student . grade } 학년</ Grade >
41
- < ClassNo > { student . classNo } 반</ ClassNo >
42
- < StudentNo > { student . studentNo } 번</ StudentNo >
50
+ < Grade > { grade } 학년</ Grade >
51
+ < ClassNo > { classNo } 반</ ClassNo >
52
+ < StudentNo > { studentNo } 번</ StudentNo >
43
53
< Name > { student . name } </ Name >
44
54
</ Row >
45
55
< MeisterPoint > 마이스터역량인증제 점수 ㆍ { score } 점</ MeisterPoint >
@@ -60,6 +70,7 @@ const Container = styled.div`
60
70
display: flex;
61
71
align-items: center;
62
72
gap: 18px;
73
+ cursor: pointer;
63
74
` ;
64
75
65
76
const RankText = styled . div `
0 commit comments