Skip to content

Commit

Permalink
Improveing default filters
Browse files Browse the repository at this point in the history
  • Loading branch information
dvargas92495 committed Mar 15, 2022
1 parent 0e34bcc commit fec4449
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"roamjs-components": "^0.52.6"
"roamjs-components": "^0.52.8"
}
}
70 changes: 35 additions & 35 deletions src/components/ResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ const ResultHeader = ({
setActiveSort,
filters,
setFilters,
initialFilter,
}: {
c: string;
results: Result[];
activeSort: Sorts;
setActiveSort: (s: Sorts) => void;
filters: Filters;
setFilters: (f: Filters) => void;
initialFilter: Filters[string];
}) => {
const filterData = useMemo(
() => ({
Expand Down Expand Up @@ -121,6 +123,7 @@ const ResultHeader = ({
)}
<Filter
data={filterData}
initialValue={initialFilter}
onChange={(newFilters) =>
setFilters({ ...filters, [c]: newFilters })
}
Expand Down Expand Up @@ -506,42 +509,39 @@ const ResultsView = ({
/>
</Tooltip>
</div>
{sortedResults.length ? (
<HTMLTable
style={{
maxHeight: "400px",
overflowY: "scroll",
width: "100%",
tableLayout: "fixed",
}}
striped
interactive
bordered
>
<thead>
<tr>
{columns.map((c) => (
<ResultHeader
key={c}
c={c}
results={results}
activeSort={activeSort}
setActiveSort={setActiveSort}
filters={filters}
setFilters={setFilters}
/>
))}
</tr>
</thead>
<tbody>
{sortedResults.map((r) => (
<ResultView key={r.uid} r={r} colSpan={columns.length} />
<HTMLTable
style={{
maxHeight: "400px",
overflowY: "scroll",
width: "100%",
tableLayout: "fixed",
}}
striped
interactive
bordered
>
<thead>
<tr>
{columns.map((c) => (
<ResultHeader
key={c}
c={c}
results={results}
activeSort={activeSort}
setActiveSort={setActiveSort}
filters={filters}
setFilters={setFilters}
initialFilter={savedFiltedData[c]}
/>
))}
</tbody>
</HTMLTable>
) : (
<div>No Results</div>
)}
</tr>
</thead>
<tbody>
{sortedResults.map((r) => (
<ResultView key={r.uid} r={r} colSpan={columns.length} />
))}
</tbody>
</HTMLTable>
</div>
</div>
);
Expand Down

0 comments on commit fec4449

Please sign in to comment.