11import { useState } from 'react' ;
2- import './DisplayBox.css' ;
2+ import styles from './DisplayBox.module .css' ;
33
44export default function DisplayBox ( { onClose } ) {
55 const mockPromotionData = [
@@ -13,6 +13,8 @@ export default function DisplayBox({ onClose }) {
1313 { week : '2024-06-15' , prCount : 10 } ,
1414 { week : '2024-06-22' , prCount : 18 } ,
1515 { week : '2024-06-29' , prCount : 14 } ,
16+ { week : '2024-07-06' , prCount : 16 } ,
17+ { week : '2024-07-13' , prCount : 20 } ,
1618 ] ,
1719 } ,
1820 {
@@ -29,7 +31,7 @@ export default function DisplayBox({ onClose }) {
2931 } ,
3032 ] ;
3133
32- const [ checkedItems , setCheckedItems ] = useState ( Array ( mockPromotionData . length ) . fill ( false ) ) ;
34+ const [ checkedItems , setCheckedItems ] = useState ( new Array ( mockPromotionData . length ) . fill ( true ) ) ;
3335 const allChecked = checkedItems . every ( Boolean ) ;
3436
3537 const handleCheckedBoxChange = index => {
@@ -39,14 +41,16 @@ export default function DisplayBox({ onClose }) {
3941 } ;
4042
4143 const handleSelectAll = ( ) => {
42- setCheckedItems ( Array ( mockPromotionData . length ) . fill ( ! allChecked ) ) ;
44+ setCheckedItems ( new Array ( mockPromotionData . length ) . fill ( ! allChecked ) ) ;
4345 } ;
4446
4547 return (
46- < div className = "overlay" >
47- < div className = "popup" >
48- < h2 className = "popup-heading" > Are you sure you want to promote these PR reviewers?</ h2 >
49- < table className = "popup-table" >
48+ < div className = { styles . overlay } >
49+ < div className = { styles . popup } >
50+ < h2 className = { styles [ 'popup-heading' ] } >
51+ Are you sure you want to promote these PR reviewers?
52+ </ h2 >
53+ < table className = { styles [ 'popup-table' ] } >
5054 < thead >
5155 < tr >
5256 < th >
@@ -78,10 +82,10 @@ export default function DisplayBox({ onClose }) {
7882 < td > { promotion . teamCode } </ td >
7983 < td > { promotion . teamReviewerName } </ td >
8084 < td >
81- { promotion . weeklyPRs . map ( pr => (
85+ { promotion . weeklyPRs . map ( ( pr , prIndex ) => (
8286 < span
8387 key = { `${ promotion . prReviewer } -${ pr . week } ` }
84- className = { `pr-count-badge color-${ pr . week } ` }
88+ className = { `${ styles [ ' pr-count-badge' ] } ${ styles [ ` color-${ prIndex } ` ] } ` }
8589 >
8690 { pr . prCount }
8791 </ span >
@@ -91,11 +95,11 @@ export default function DisplayBox({ onClose }) {
9195 ) ) }
9296 </ tbody >
9397 </ table >
94- < div className = " button-row" >
95- < button type = "button" className = " button" onClick = { onClose } >
98+ < div className = { styles [ ' button-row' ] } >
99+ < button type = "button" className = { styles . button } onClick = { onClose } >
96100 Cancel
97101 </ button >
98- < button type = "button" className = " button" disabled = { ! checkedItems . some ( Boolean ) } >
102+ < button type = "button" className = { styles . button } disabled = { ! checkedItems . some ( Boolean ) } >
99103 Confirm
100104 </ button >
101105 </ div >
0 commit comments