Skip to content

Commit

Permalink
Remove sort radio-buttons (#2085)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynek authored Jan 26, 2025
1 parent c9eb5ff commit d65f9e2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
7 changes: 0 additions & 7 deletions plugins/plugin-site/src/components/Filters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import Categories from './Categories';
import Sort from './Sort';
import './Filters.css';

function Filters({
showFilter,
showResults,
sort, setSort,
clearCriteria,
categories, toggleCategory,
labels, toggleLabel
Expand All @@ -20,9 +18,6 @@ function Filters({
<fieldset>
<div className={classNames('Filters--Container', 'filters', 'container')}>
<div className="row headerContainer">
<div className={showResults ? 'col-md-12' : 'col-md-3'}>
<Sort setSort={setSort} sort={sort} />
</div>
<div className={showResults ? 'col-md-12' : 'col-md-9'}>
<Categories
anyCriteria={false}
Expand All @@ -42,8 +37,6 @@ function Filters({
Filters.propTypes = {
showFilter: PropTypes.bool.isRequired,
showResults: PropTypes.bool.isRequired,
sort: PropTypes.string.isRequired,
setSort: PropTypes.func.isRequired,
clearCriteria: PropTypes.func.isRequired,
categories: PropTypes.arrayOf(PropTypes.string).isRequired,
toggleCategory: PropTypes.func.isRequired,
Expand Down
3 changes: 1 addition & 2 deletions plugins/plugin-site/src/components/FiltersHooks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {navigate} from 'gatsby';
import ucFirst from '../utils/ucfirst';

const DEFAULT_DATA = {
sort: 'relevance',
categories: [],
labels: [],
view: 'Tiles',
Expand Down Expand Up @@ -32,7 +31,7 @@ function useFilterHooks() {
setData(newData);
};

['sort', 'categories', 'labels', 'view', 'page', 'query'].forEach(key => {
['categories', 'labels', 'view', 'page', 'query'].forEach(key => {
ret[`set${ucFirst(key)}`] = (val) => {
const newData = {...data, [key]: val};
if (key !== 'page') {
Expand Down
5 changes: 1 addition & 4 deletions plugins/plugin-site/src/templates/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ function SearchPage({location}) {
const categoriesMap = groupBy(graphqlData.categories.edges.map(edge => edge.node), 'id');
const suspendedPlugins = graphqlData.suspendedPlugins.edges.map(edge => edge.node.id);
const {
sort, setSort,
clearCriteria,
categories, toggleCategory,
labels, toggleLabel,
Expand All @@ -106,7 +105,7 @@ function SearchPage({location}) {
} = useFilterHooks();

const handleOnSubmit = (e) => {
const newData = {sort, categories, labels, view, page, query};
const newData = {categories, labels, view, page, query};
e.preventDefault();
navigate(`/ui/search?${new URLSearchParams(newData)}`);
};
Expand All @@ -132,10 +131,8 @@ function SearchPage({location}) {
<Filters
showFilter={showFilter}
showResults
sort={sort}
categories={categories}
labels={labels}
setSort={setSort}
clearCriteria={clearCriteria}
toggleCategory={toggleCategory}
toggleLabel={toggleLabel}
Expand Down

0 comments on commit d65f9e2

Please sign in to comment.