@@ -117,7 +117,7 @@ const listTitles: { [field in keyof TopLevelListsState]: string } = {
117
117
questionStatus : siteSpecific ( "Status" , "Question status" )
118
118
} ;
119
119
120
- interface QuestionFinderFilterPanelProps {
120
+ export interface QuestionFinderFilterPanelProps {
121
121
searchDifficulties : Difficulty [ ] ; setSearchDifficulties : Dispatch < SetStateAction < Difficulty [ ] > > ;
122
122
searchTopics : string [ ] , setSearchTopics : Dispatch < SetStateAction < string [ ] > > ;
123
123
searchStages : STAGE [ ] , setSearchStages : Dispatch < SetStateAction < STAGE [ ] > > ;
@@ -165,36 +165,40 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
165
165
}
166
166
} ;
167
167
168
- return < Card >
168
+ return < div className = { classNames ( { "card" : isAda } ) } >
169
169
< CardHeader className = "finder-header pl-3" onClick = { ( e ) => {
170
170
// the filters panel can only be collapsed when it is not a sidebar
171
171
// (changing screen size after collapsing does not re-expand it but the options become visible)
172
172
if ( below [ "md" ] ( deviceSize ) ) handleFilterPanelExpansion ( e ) ;
173
173
} } >
174
- < div >
175
- < img
176
- src = "/assets/common/icons/filter-icon.svg"
177
- alt = "Filter"
178
- style = { { width : 18 } }
179
- className = "ms-1 me-2"
180
- />
181
- < b > Filter by</ b >
182
- </ div >
183
- < Spacer />
184
- { validFiltersSelected && < div className = "pe-1 pe-lg-0" >
185
- < button
186
- className = { "text-black pe-lg-0 py-0 me-2 me-lg-0 bg-white bg-opacity-10 btn-link" }
187
- onClick = { ( e ) => {
188
- e . stopPropagation ( ) ;
189
- clearFilters ( ) ;
190
- } }
191
- >
192
- Clear all
193
- </ button >
194
- </ div > }
195
- { below [ "md" ] ( deviceSize ) && < div >
174
+ { siteSpecific (
175
+ < h6 > Filter questions by</ h6 > ,
176
+ < >
177
+ < div >
178
+ < img
179
+ src = "/assets/common/icons/filter-icon.svg"
180
+ alt = "Filter"
181
+ style = { { width : 18 } }
182
+ className = "ms-1 me-2"
183
+ />
184
+ < b > Filter by</ b >
185
+ </ div >
186
+ < Spacer />
187
+ { validFiltersSelected && < div className = "pe-1 pe-lg-0" >
188
+ < button
189
+ className = { classNames ( "text-black pe-lg-0 py-0 me-2 me-lg-0 bg-opacity-10 btn-link" , { "bg-white" : isAda } ) }
190
+ onClick = { ( e ) => {
191
+ e . stopPropagation ( ) ;
192
+ clearFilters ( ) ;
193
+ } }
194
+ >
195
+ Clear all
196
+ </ button >
197
+ </ div > }
198
+ </ > ) }
199
+ { below [ "md" ] ( deviceSize ) && isAda && < div >
196
200
< button
197
- className = "bg-white bg- opacity-10 p-0"
201
+ className = "bg-opacity-10 p-0 bg-white "
198
202
onClick = { handleFilterPanelExpansion }
199
203
>
200
204
< img
@@ -207,14 +211,14 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
207
211
</ button >
208
212
</ div > }
209
213
</ CardHeader >
210
- < CardBody className = { classNames ( "p-0 m-0" , { "d-none" : below [ "md" ] ( deviceSize ) && ! filtersVisible } ) } >
214
+ < CardBody className = { classNames ( "p-0 m-0" , { "d-none" : isAda && below [ "md" ] ( deviceSize ) && ! filtersVisible } ) } >
211
215
< CollapsibleList
212
216
title = { listTitles . stage } expanded = { listState . stage . state }
213
217
toggle = { ( ) => listStateDispatch ( { type : "toggle" , id : "stage" , focus : below [ "md" ] ( deviceSize ) } ) }
214
218
numberSelected = { ( isAda && searchStages . includes ( STAGE . ALL ) ) ? searchStages . length - 1 : searchStages . length }
215
219
>
216
220
{ getFilteredStageOptions ( ) . map ( ( stage , index ) => (
217
- < div className = "w-100 ps-3 py-1 bg-white" key = { index } >
221
+ < div className = { classNames ( "w-100 ps-3 py-1" , { " bg-white": isAda } ) } key = { index } >
218
222
< StyledCheckbox
219
223
color = "primary"
220
224
checked = { searchStages . includes ( stage . value ) }
@@ -230,7 +234,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
230
234
numberSelected = { searchExamBoards . length }
231
235
>
232
236
{ getFilteredExamBoardOptions ( { byStages : searchStages } ) . map ( ( board , index ) => (
233
- < div className = "w-100 ps-3 py-1 bg-white" key = { index } >
237
+ < div className = { classNames ( "w-100 ps-3 py-1" , { " bg-white": isAda } ) } key = { index } >
234
238
< StyledCheckbox
235
239
color = "primary"
236
240
checked = { searchExamBoards . includes ( board . value ) }
@@ -263,7 +267,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
263
267
toggle = { ( ) => listStateDispatch ( { type : "toggle" , id : `topics ${ sublistDelimiter } ${ tag . label } ` , focus : true } ) }
264
268
>
265
269
{ tag . options . map ( ( topic , index ) => (
266
- < div className = "w-100 ps-3 py-1 bg-white" key = { index } >
270
+ < div className = { classNames ( "w-100 ps-3 py-1" , { " bg-white": isAda } ) } key = { index } >
267
271
< StyledCheckbox
268
272
color = "primary"
269
273
checked = { searchTopics . includes ( topic . value ) }
@@ -288,15 +292,15 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
288
292
numberSelected = { searchDifficulties . length }
289
293
>
290
294
< button
291
- className = "p-0 bg-white h-min-content btn-link d-flex ps-3 py-2"
295
+ className = { classNames ( "p-0 h-min-content btn-link d-flex ps-3 py-2" , { "bg-white" : isAda , "bg-transparent" : isPhy } ) }
292
296
onClick = { ( e ) => {
293
297
e . preventDefault ( ) ;
294
298
dispatch ( openActiveModal ( questionFinderDifficultyModal ( ) ) ) ;
295
299
} } >
296
300
< b className = "small text-start" > { siteSpecific ( "Learn more about difficulty levels" , "What do the difficulty levels mean?" ) } </ b >
297
301
</ button >
298
302
{ SIMPLE_DIFFICULTY_ITEM_OPTIONS . map ( ( difficulty , index ) => (
299
- < div className = "w-100 ps-3 py-1 bg-white" key = { index } >
303
+ < div className = { classNames ( "w-100 ps-3 py-1" , { " bg-white": isAda } ) } key = { index } >
300
304
< StyledCheckbox
301
305
color = "primary"
302
306
checked = { searchDifficulties . includes ( difficulty . value ) }
@@ -307,7 +311,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
307
311
) }
308
312
label = { < div className = "d-flex align-items-center" >
309
313
< span className = "me-2" > { difficulty . label } </ span >
310
- < DifficultyIcons difficulty = { difficulty . value } blank className = "mt-n2" />
314
+ < DifficultyIcons difficulty = { difficulty . value } blank className = { classNames ( { "mt-n2" : isAda , "mt-2" : isPhy } ) } />
311
315
</ div > }
312
316
/>
313
317
</ div >
@@ -319,7 +323,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
319
323
numberSelected = { excludeBooks ? 1 : searchBooks . length }
320
324
>
321
325
< >
322
- < div className = "w-100 ps-3 py-1 bg-white" >
326
+ < div className = { classNames ( "w-100 ps-3 py-1" , { " bg-white": isAda } ) } >
323
327
< StyledCheckbox
324
328
color = "primary"
325
329
checked = { excludeBooks }
@@ -328,7 +332,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
328
332
/>
329
333
</ div >
330
334
{ bookOptions . map ( ( book , index ) => (
331
- < div className = "w-100 ps-3 py-1 bg-white" key = { index } >
335
+ < div className = { classNames ( "w-100 ps-3 py-1" , { " bg-white": isAda } ) } key = { index } >
332
336
< StyledCheckbox
333
337
color = "primary" disabled = { excludeBooks }
334
338
checked = { searchBooks . includes ( book . value ) && ! excludeBooks }
@@ -348,7 +352,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
348
352
toggle = { ( ) => listStateDispatch ( { type : "toggle" , id : "questionStatus" , focus : below [ "md" ] ( deviceSize ) } ) }
349
353
numberSelected = { Object . values ( searchStatuses ) . reduce ( ( acc , item ) => acc + item , 0 ) }
350
354
>
351
- < div className = "w-100 ps-3 py-1 bg-white d-flex align-items-center" >
355
+ < div className = { classNames ( "w-100 ps-3 py-1 d-flex align-items-center" , { "bg-white" : isAda } ) } >
352
356
< StyledCheckbox
353
357
color = "primary"
354
358
checked = { searchStatuses . notAttempted }
@@ -371,7 +375,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
371
375
</ div > }
372
376
/>
373
377
</ div >
374
- < div className = "w-100 ps-3 py-1 bg-white d-flex align-items-center" >
378
+ < div className = { classNames ( "w-100 ps-3 py-1 d-flex align-items-center" , { "bg-white" : isAda } ) } >
375
379
< StyledCheckbox
376
380
color = "primary"
377
381
checked = { searchStatuses . complete }
@@ -394,7 +398,7 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
394
398
</ div > }
395
399
/>
396
400
</ div >
397
- < div className = "w-100 ps-3 py-1 bg-white d-flex align-items-center" >
401
+ < div className = { classNames ( "w-100 ps-3 py-1 d-flex align-items-center" , { "bg-white" : isAda } ) } >
398
402
< StyledCheckbox
399
403
color = "primary"
400
404
checked = { searchStatuses . tryAgain }
@@ -442,14 +446,14 @@ export function QuestionFinderFilterPanel(props: QuestionFinderFilterPanelProps)
442
446
</span>}
443
447
/>
444
448
</div>}*/ }
445
- < Col className = "text-center py-3 filter-btn bg-white border-radius-2" >
449
+ { isAda && < Col className = "text-center py-3 filter-btn bg-white border-radius-2" >
446
450
< Button onClick = { ( ) => {
447
451
applyFilters ( ) ;
448
452
setSearchDisabled ( true ) ;
449
453
} } disabled = { searchDisabled } >
450
454
Apply filters
451
455
</ Button >
452
- </ Col >
456
+ </ Col > }
453
457
</ CardBody >
454
- </ Card > ;
458
+ </ div > ;
455
459
}
0 commit comments