Skip to content

Commit 31bb3ef

Browse files
author
ohjunsang
committed
[FIX] 어드민 다운로드 버그 수정
1 parent 9c0d72f commit 31bb3ef

File tree

4 files changed

+74
-19
lines changed

4 files changed

+74
-19
lines changed

src/components/Admin_Main/component/MainListContent.js

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
1-
import React from 'react';
1+
import React, { useState, useCallback } from 'react';
22
import * as S from '../style/MainStyle';
3+
import { download } from '../imgs'
34
const MainListContent = ({
45
number,
56
name,
67
isChecked,
78
getFile
89
}) => {
10+
const [mouseOver, mouseOverChange] = useState(false);
11+
const mouseOverHandler = useCallback((event)=> {
12+
mouseOverChange(true);
13+
}, []);
14+
const mouseOutHandler = useCallback(()=> {
15+
mouseOverChange(false);
16+
}, []);
917
return (
10-
<S.MainListContent onClick={()=>{getFile(number)}}>
11-
<td>{number}</td>
12-
<td>{name}</td>
13-
<td>{isChecked ? isChecked === 1 ? "✔️" : "⚠️" : "❌"}</td>
18+
<S.MainListContent
19+
onMouseEnter={mouseOverHandler}
20+
onMouseOut={mouseOutHandler}
21+
>
22+
{
23+
mouseOver ?
24+
<td
25+
className="hoverable"
26+
onClick={()=>{getFile(number)}}
27+
colSpan={3}
28+
>
29+
다운로드 하기
30+
</td> :
31+
(
32+
<>
33+
<td>{number}</td>
34+
<td>{name}</td>
35+
<td>{isChecked ? isChecked === 1 ? "✔️" : "⚠️" : "❌"}</td>
36+
</>
37+
)
38+
}
1439
</S.MainListContent>
1540
)
1641
}

src/components/Admin_Main/component/MainTeamClass.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ const MainTeamClass = ({
5959
<div>
6060
<AccessTokenConsumer>
6161
{
62-
({ state, actions}) => {
62+
({ state, actions }) => {
6363
return <MainTeamList
64-
state={state}
65-
actions={actions}
66-
teamList={teamList}
67-
text="팀 과제"
68-
contentId={contentId}
64+
state={state}
65+
actions={actions}
66+
teamList={teamList}
67+
text="팀 과제"
68+
contentId={contentId}
6969
/>
7070
}
7171
}

src/components/Admin_Main/component/MainTeamListContent.js

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import React from 'react';
1+
import React, { useState, useCallback } from 'react';
22
import * as S from '../style/MainStyle';
3+
import { download } from '../imgs';
34

45
const MainTeamListContent = ({
56
teamList,
@@ -8,12 +9,40 @@ const MainTeamListContent = ({
89
count,
910
getFileCode
1011
}) => {
11-
const color = count % 2 === 0 ? "#F5F5F5" : "white";
12+
const color = count % 2 === 0 ? "#F5F5F5" : "white";
13+
const [mouseOver, mouseOverChange] = useState(false);
14+
const mouseOverHandler = useCallback((event)=> {
15+
mouseOverChange(true);
16+
console.log("mouseOver")
17+
}, []);
18+
const mouseOutHandler = useCallback(()=> {
19+
mouseOverChange(false);
20+
console.log("mouseLeave")
21+
}, []);
1222
return (
1323
<>
14-
<S.MainTeamListContent color={color} onClick={()=> {getFileCode(teamName)}}>
15-
<td className="team" colSpan={2}><b>{teamName}</b></td>
16-
<td className="status">{submit > 0 ? submit === 1 ? "✔️" : "⚠️" : "❌"}</td>
24+
<S.MainTeamListContent
25+
color={color}
26+
onMouseEnter={mouseOverHandler}
27+
onMouseOut={mouseOutHandler}
28+
>
29+
{
30+
mouseOver ?
31+
<td
32+
className="hoverable"
33+
onClick={()=>{getFileCode(teamName)}}
34+
colSpan={3}
35+
>
36+
다운로드 하기
37+
<img alt="" src={download}/>
38+
</td> :
39+
(
40+
<>
41+
<td className="team" colSpan={2}><b>{teamName}</b></td>
42+
<td className="status">{submit > 0 ? submit === 1 ? "✔️" : "⚠️" : "❌"}</td>
43+
</>
44+
)
45+
}
1746
</S.MainTeamListContent>
1847
{
1948
teamList.map((info)=> {

src/components/Admin_Main/style/MainStyle.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ export const MainClassCoutColoredBar = styled.div`
173173
`
174174

175175
export const MainListContent = styled.tr`
176-
background: "white";
177176
font-size: 14px;
177+
position: relative;
178+
width: 100%;
178179
height: ${props => props.isHeader ? 35 : 25}px;
179180
&:nth-child(odd){
180181
background-color: #F5F5F5;
@@ -288,7 +289,7 @@ export const MainLoadingContent = styled.div`
288289
.ldio-dlvqi1wu39l > div div:nth-child(6) {
289290
width: 80px;
290291
height: 80px;
291-
background: #f1f2f3;
292+
background: #F5F5F5;
292293
border-radius: 50%;
293294
}.ldio-dlvqi1wu39l > div div:nth-child(3) {
294295
transform: translate(-50%,-50%) rotate(45deg)
@@ -302,7 +303,7 @@ export const MainLoadingContent = styled.div`
302303
height: 200px;
303304
display: inline-block;
304305
overflow: hidden;
305-
background: #f1f2f3;
306+
background: #F5F5F5;
306307
}
307308
.ldio-dlvqi1wu39l {
308309
width: 100%;

0 commit comments

Comments
 (0)