Skip to content

Commit

Permalink
add back company filter (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-step committed Aug 7, 2022
1 parent 2202aa4 commit bdbb042
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ const Table = () => {
</>
);
},
accessor: 'companies',
accessor: 'companyNames',
sortType: (a, b) => {
if (a.original.companies.length === b.original.companies.length) {
return 0;
Expand All @@ -399,7 +399,7 @@ const Table = () => {

return <Row className="companies">{companies}</Row>;
},
disableFilters: true,
Filter: SelectColumnFilter,
},
],
},
Expand Down Expand Up @@ -436,8 +436,8 @@ const Table = () => {
value: localStorage.getItem('pattern') || '',
},
{
id: 'companies',
value: localStorage.getItem('companies') || '',
id: 'companyNames',
value: localStorage.getItem('companyNames') || '',
},
],
},
Expand Down
4 changes: 4 additions & 0 deletions src/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ import questions from './questions.json';
const sortBy = { Easy: 0, Medium: 1, Hard: 2 };
const { updated, data } = questions;

for (let i = 0; i < data.length; i += 1) {
data[i].companyNames = data[i].companies.map(company => company.name);
}

export { updated };
export default data.sort((a, b) => sortBy[a.difficulty] - sortBy[b.difficulty]);

0 comments on commit bdbb042

Please sign in to comment.