File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 41
41
}
42
42
43
43
.problem-card {
44
+ display : block;
44
45
background-color : # 282a36 ;
45
46
border-radius : 5px ;
46
47
padding : 20px 20px ;
52
53
}
53
54
54
55
.problem-card : hover {
56
+ color : white;
57
+ text-decoration : none;
55
58
background-color : # 1a1c27 ;
56
59
}
57
60
Original file line number Diff line number Diff line change @@ -83,13 +83,14 @@ const Main = ({ updateProblem }) => {
83
83
</ div >
84
84
< div className = "problems" >
85
85
{ _ . map ( problems , ( problem ) => (
86
- < div
87
- className = "problem-card"
86
+ < a
88
87
onClick = { ( ) => updateProblem ( problem . number ) }
88
+ href = { "#" + problem . number }
89
89
key = { problem . number }
90
+ className = "problem-card"
90
91
>
91
92
{ problem [ "number" ] + ". " + problem [ "name" ] }
92
- </ div >
93
+ </ a >
93
94
) ) }
94
95
</ div >
95
96
{ ! problems . length && difficulty !== "All" && (
@@ -178,6 +179,11 @@ const Problem = ({ problem, updateProblem }) => {
178
179
const App = ( ) => {
179
180
const [ problem , updateProblem ] = useState ( null ) ;
180
181
182
+ useEffect ( ( ) => {
183
+ const problemId = window . location . hash . substring ( 1 ) ;
184
+ if ( data [ problemId ] ) updateProblem ( problemId ) ;
185
+ } , [ window . location ] ) ;
186
+
181
187
return (
182
188
< div className = "app" >
183
189
< Main { ...{ updateProblem } } />
You can’t perform that action at this time.
0 commit comments