@@ -6,23 +6,23 @@ import React, {
66type SortOption = 'enrolled' | 'title' ;
77
88interface FiltersContextType {
9- filters : string [ ] ;
10- sortBy : SortOption ;
11- pageNumber : number ;
12- setFilters : ( newFilters : string [ ] ) => void ;
13- addFilter : ( filter : string ) => void ;
14- removeFilter : ( filter : string ) => void ;
15- clearFilters : ( ) => void ;
16- setSortBy : ( sortBy : SortOption ) => void ;
17- setPageNumber : ( pageNumber : number ) => void ;
9+ filters : string [ ] ,
10+ sortBy : SortOption ,
11+ pageNumber : number ,
12+ setFilters : ( newFilters : string [ ] ) => void ,
13+ addFilter : ( filter : string ) => void ,
14+ removeFilter : ( filter : string ) => void ,
15+ clearFilters : ( ) => void ,
16+ setSortBy : ( sortBy : SortOption ) => void ,
17+ setPageNumber : ( pageNumber : number ) => void ,
1818}
1919
2020const FiltersContext = createContext < FiltersContextType | null > ( null ) ;
2121
2222interface FiltersState {
23- filters : string [ ] ;
24- sortBy : SortOption ;
25- pageNumber : number ;
23+ filters : string [ ] ,
24+ sortBy : SortOption ,
25+ pageNumber : number ,
2626}
2727
2828const initialState : FiltersState = {
@@ -32,12 +32,12 @@ const initialState: FiltersState = {
3232} ;
3333
3434type FiltersAction =
35- | { type : 'SET_FILTERS' ; payload : string [ ] }
36- | { type : 'ADD_FILTER' ; payload : string }
37- | { type : 'REMOVE_FILTER' ; payload : string }
35+ | { type : 'SET_FILTERS' , payload : string [ ] }
36+ | { type : 'ADD_FILTER' , payload : string }
37+ | { type : 'REMOVE_FILTER' , payload : string }
3838 | { type : 'CLEAR_FILTERS' }
39- | { type : 'SET_SORT_BY' ; payload : SortOption }
40- | { type : 'SET_PAGE_NUMBER' ; payload : number } ;
39+ | { type : 'SET_SORT_BY' , payload : SortOption }
40+ | { type : 'SET_PAGE_NUMBER' , payload : number } ;
4141
4242const filtersReducer = ( state : FiltersState , action : FiltersAction ) : FiltersState => {
4343 switch ( action . type ) {
0 commit comments