1
1
import React , { useEffect , useState } from 'react'
2
2
3
- import {
4
- ArticleGuide ,
5
- useProductGuidesContext ,
6
- } from 'components/context/ProductGuidesContext'
3
+ import { ArticleGuide , useProductGuidesContext } from 'components/context/ProductGuidesContext'
7
4
import { useTranslation } from 'components/hooks/useTranslation'
8
5
import { ArticleCard } from './ArticleCard'
9
6
import { DropdownMenu } from '@primer/components'
@@ -35,20 +32,16 @@ export const ArticleCards = () => {
35
32
const guides = isUserFiltering ? filteredResults : includeGuides || [ ]
36
33
37
34
const types = Object . entries ( guideTypes ) . map ( ( [ key , val ] ) => {
38
- return (
39
- { text : val , key : key }
40
- )
35
+ return { text : val , key : key }
41
36
} ) as ItemInput [ ]
42
-
43
- types . unshift ( { text : t ( 'filters.all' ) , key : undefined } )
44
-
37
+
38
+ types . unshift ( { text : t ( 'filters.all' ) , key : undefined } )
39
+
45
40
const topics = allTopics ?. map ( ( topic ) => {
46
- return (
47
- { text : topic , key : topic }
48
- )
41
+ return { text : topic , key : topic }
49
42
} ) as ItemInput [ ]
50
43
51
- topics . unshift ( { text : t ( 'filters.all' ) , key : undefined } )
44
+ topics . unshift ( { text : t ( 'filters.all' ) , key : undefined } )
52
45
53
46
return (
54
47
< div >
@@ -58,26 +51,28 @@ export const ArticleCards = () => {
58
51
< label htmlFor = "type" className = "text-uppercase f6 color-fg-muted d-block" >
59
52
{ t ( 'filters.type' ) }
60
53
</ label >
61
- < DropdownMenu
62
- aria-label = "guide types"
63
- data-testid = "types-dropdown"
64
- placeholder = { t ( 'filters.all' ) }
65
- items = { types }
66
- selectedItem = { typeFilter }
67
- onChange = { setTypeFilter } />
54
+ < DropdownMenu
55
+ aria-label = "guide types"
56
+ data-testid = "types-dropdown"
57
+ placeholder = { t ( 'filters.all' ) }
58
+ items = { types }
59
+ selectedItem = { typeFilter }
60
+ onChange = { setTypeFilter }
61
+ />
68
62
</ div >
69
63
70
64
< div data-testid = "card-filter-topics" className = "mx-4" >
71
65
< label htmlFor = "topic" className = "text-uppercase f6 color-fg-muted d-block" >
72
66
{ t ( 'filters.topic' ) }
73
67
</ label >
74
- < DropdownMenu
75
- aria-label = "guide topics"
76
- data-testid = "topics-dropdown"
77
- placeholder = { t ( 'filters.all' ) }
78
- items = { topics }
79
- selectedItem = { topicFilter }
80
- onChange = { setTopicFilter } />
68
+ < DropdownMenu
69
+ aria-label = "guide topics"
70
+ data-testid = "topics-dropdown"
71
+ placeholder = { t ( 'filters.all' ) }
72
+ items = { topics }
73
+ selectedItem = { topicFilter }
74
+ onChange = { setTopicFilter }
75
+ />
81
76
</ div >
82
77
</ form >
83
78
0 commit comments