File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Frontend/src/components/matching Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { Card , Badge } from 'react-bootstrap' ;
3
+
4
+ const getBadgeVariant = ( difficulty ) => {
5
+ switch ( difficulty ) {
6
+ case 'easy' :
7
+ return 'success' ;
8
+ case 'medium' :
9
+ return 'warning' ;
10
+ case 'hard' :
11
+ return 'danger' ;
12
+ default :
13
+ return 'secondary' ; // in case no difficulty chosen
14
+ }
15
+ }
16
+
17
+ const capitalizeFirstLetter = ( difficulty ) => {
18
+
19
+ if ( difficulty == "cplusplus" ) {
20
+ return difficulty . charAt ( 0 ) . toUpperCase ( ) + "++"
21
+ }
22
+
23
+ return difficulty . charAt ( 0 ) . toUpperCase ( ) + difficulty . slice ( 1 ) ;
24
+ }
25
+
26
+ const CriteriaDisplay = ( { difficulty, language } ) => {
27
+ return (
28
+ < Card className = "mt-3" style = { { width : '20rem' } } >
29
+ < Card . Body >
30
+ < Card . Title > Selected Criteria</ Card . Title >
31
+ < Card . Text >
32
+ < span >
33
+ Difficulty: < Badge bg = { getBadgeVariant ( difficulty ? difficulty : "Null" ) } > { capitalizeFirstLetter ( difficulty ? difficulty : "Null" ) } </ Badge > { ' ' }
34
+ Language: < strong > { capitalizeFirstLetter ( language ? language : "???" ) } </ strong >
35
+ </ span >
36
+ </ Card . Text >
37
+ </ Card . Body >
38
+ </ Card >
39
+ )
40
+ } ;
41
+
42
+ export default CriteriaDisplay ;
You can’t perform that action at this time.
0 commit comments