Skip to content

Commit f672cbd

Browse files
committed
revert reordering
1 parent d34c4a1 commit f672cbd

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

components/search/bills/BillSearch.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ const useSearchStatus = () => {
102102
const Layout: FC<
103103
React.PropsWithChildren<{ items: SortByWithConfigurationItem[] }>
104104
> = ({ items }) => {
105-
const courtRefinements = useBillRefinements(1)
106-
const refinements = useBillRefinements(2)
105+
const refinements = useBillRefinements()
107106
const hierarchicalMenu = useBillHierarchicalMenu()
108107
const status = useSearchStatus()
109108

@@ -116,15 +115,13 @@ const Layout: FC<
116115
</Row>
117116
<Row>
118117
<Col xs={3} lg={3}>
119-
{courtRefinements.options}
120118
{hierarchicalMenu.options}
121119
{refinements.options}
122120
</Col>
123121
<Col className="d-flex flex-column">
124122
<RefinementRow>
125123
<ResultCount className="flex-grow-1 m-1" />
126124
<SortBy items={items} />
127-
{courtRefinements.show}
128125
{hierarchicalMenu.show}
129126
{refinements.show}
130127
</RefinementRow>

components/search/bills/useBillRefinements.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import { useRefinements } from "../useRefinements"
1616
// attribute: "court",
1717
// searchablePlaceholder: "Legislative Session",
1818

19-
export const useBillRefinements = (list: Number) => {
19+
export const useBillRefinements = () => {
2020
const baseProps = { limit: 500, searchable: true }
21-
const propsList1 = [
21+
const propsList = [
2222
{
2323
transformItems: useCallback(
2424
(i: RefinementListItem[]) =>
@@ -33,9 +33,7 @@ export const useBillRefinements = (list: Number) => {
3333
attribute: "court",
3434
searchablePlaceholder: "Legislative Session",
3535
...baseProps
36-
}
37-
]
38-
const propsList2 = [
36+
},
3937
{
4038
attribute: "currentCommittee",
4139
...baseProps,
@@ -58,12 +56,5 @@ export const useBillRefinements = (list: Number) => {
5856
}
5957
]
6058

61-
let propsList = []
62-
if (list === 1) {
63-
propsList = propsList1
64-
} else {
65-
propsList = propsList2
66-
}
67-
6859
return useRefinements({ refinementProps: propsList })
6960
}

components/search/useHierarchicalMenu.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTranslation } from "next-i18next"
12
import { useInstantSearch } from "react-instantsearch"
23
import { faFilter } from "@fortawesome/free-solid-svg-icons"
34
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
@@ -42,13 +43,15 @@ export const useHierarchicalMenu = ({
4243
)
4344
const hasRefinements = useHasRefinements()
4445

46+
const { t } = useTranslation("billSearch")
47+
4548
return {
4649
options: inline ? (
4750
<div>{hierarchicalMenu}</div>
4851
) : (
4952
<Offcanvas show={show} onHide={handleClose}>
5053
<Offcanvas.Header closeButton>
51-
<Offcanvas.Title>Filter</Offcanvas.Title>
54+
<Offcanvas.Title>{t("topics")}</Offcanvas.Title>
5255
</Offcanvas.Header>
5356
<Offcanvas.Body>
5457
<SearchContainer>{hierarchicalMenu}</SearchContainer>
@@ -62,7 +65,7 @@ export const useHierarchicalMenu = ({
6265
onClick={handleOpen}
6366
className={hasRefinements ? "ais-FilterButton-has-refinements" : ""}
6467
>
65-
<FontAwesomeIcon icon={faFilter} /> Filter
68+
<FontAwesomeIcon icon={faFilter} /> {t("topics")}
6669
</FilterButton>
6770
)
6871
}

components/search/useRefinements.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTranslation } from "next-i18next"
12
import { RefinementList, useInstantSearch } from "react-instantsearch"
23
import { faFilter } from "@fortawesome/free-solid-svg-icons"
34
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
@@ -39,13 +40,15 @@ export const useRefinements = ({
3940
)
4041
const hasRefinements = useHasRefinements()
4142

43+
const { t } = useTranslation("billSearch")
44+
4245
return {
4346
options: inline ? (
4447
<div>{refinements}</div>
4548
) : (
4649
<Offcanvas show={show} onHide={handleClose}>
4750
<Offcanvas.Header closeButton>
48-
<Offcanvas.Title>Filter</Offcanvas.Title>
51+
<Offcanvas.Title>{t("filter")}</Offcanvas.Title>
4952
</Offcanvas.Header>
5053
<Offcanvas.Body>
5154
<SearchContainer>{refinements}</SearchContainer>
@@ -59,7 +62,7 @@ export const useRefinements = ({
5962
onClick={handleOpen}
6063
className={hasRefinements ? "ais-FilterButton-has-refinements" : ""}
6164
>
62-
<FontAwesomeIcon icon={faFilter} /> Filter
65+
<FontAwesomeIcon icon={faFilter} /> {t("filter")}
6366
</FilterButton>
6467
)
6568
}

public/locales/en/billSearch.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"another_term" : "Try another search term",
33
"browse_bills" : "Browse Bills",
4+
"filter" : "Filter",
5+
"topics" : "Topics",
46
"zero_results" : "Your search has yielded zero results!"
57
}

0 commit comments

Comments
 (0)