1010 flex-direction : column;
1111 }
1212
13- .challenge-nav ul li {
14- padding : 0px 8px ;
15- }
16-
17- .challenge-nav ul li : not (: first-of-type ) a {
18- padding : 8px 10px ;
19- }
20-
2113 .challenge-nav .challenge-level {
2214 width : fit-content;
2315 border-bottom : 1px dashed hsl (240 , 2% , 90% );
3628 display : none;
3729 }
3830
31+ .passed {
32+ position : relative;
33+ }
34+
35+ .passed ::after {
36+ /* iconify: https://icon-sets.iconify.design/lets-icons/done-ring-round */
37+ content : url ('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="24" height="24" viewBox="0 0 24 24"%3E%3Cg fill="none" stroke="%2366ba6f" stroke-linecap="round" stroke-width="2"%3E%3Cpath d="m9 10l3.258 2.444a1 1 0 0 0 1.353-.142L20 5"%2F%3E%3Cpath d="M21 12a9 9 0 1 1-6.67-8.693"%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E' );
38+ display : inline-block;
39+ position : absolute;
40+ width : 24px ;
41+ height : 24px ;
42+ top : 50% ;
43+ right : 0 ;
44+ transform : translate (-50% , -50% );
45+ transition : all 1.5s ease-out;
46+ }
3947
4048 @media only screen and (max-width : 800px ) {
4149 .sidebar-toggle {
@@ -141,7 +149,7 @@ <h5 class="challenge-level">{{ level }}</h5>
141149 * @param {Event } event - The click event.
142150 */
143151 function removeHighlight ( event ) {
144- previousActiveChallenges = document . getElementsByClassName ( "active-challenge" ) ;
152+ let previousActiveChallenges = document . getElementsByClassName ( "active-challenge" ) ;
145153 for ( c of previousActiveChallenges ) {
146154 // Remove previously highlighted challenge in the list.
147155 c . classList . remove ( 'active-challenge' ) ;
@@ -151,4 +159,14 @@ <h5 class="challenge-level">{{ level }}</h5>
151159 const initialState = { { challenges_groupby_level | tojson } } ;
152160 const passedState = new PassedState ( ) ;
153161 passedState . init ( initialState ) ;
162+
163+ // Highlight the passed challenges when the page is loaded.
164+ let ids = Object . keys ( passedState . get ( ) ) . forEach ( level => {
165+ passedState . get ( ) [ level ] . forEach ( challenge => {
166+ let id = `#${ level } -${ challenge . name } ` ;
167+ if ( challenge . passed ) {
168+ document . querySelector ( id ) . parentNode . classList . add ( 'passed' ) ;
169+ }
170+ } )
171+ } )
154172</ script >
0 commit comments