Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
07ee707
Instant Search: add label and button to search box (#13875)
bluefuton Nov 3, 2019
67fa346
Instant Search: Ignore empty query values for filters (#13934)
jsnmoon Nov 4, 2019
c91e1d2
Instant Search: Pay down technical debt (#13847)
jsnmoon Nov 4, 2019
ebd22bc
Instant Search: Standardize class and ID prefixes (#13933)
jsnmoon Nov 4, 2019
5122ca6
Instant Search: Improve accessibility (#13884)
jsnmoon Nov 5, 2019
3fb17ef
Instant Search: only show multiple image icon for posts with gallery …
bluefuton Nov 6, 2019
5fbad89
Add testing instructions to README (#13969)
bluefuton Nov 6, 2019
13715ec
Instant search: add product result component (#13826)
bluefuton Nov 7, 2019
6c22f71
Instant Search: Restore caching to API requests (#13981)
jsnmoon Nov 7, 2019
f5a4e4a
Instant Search: add basic Photon support (#13998)
bluefuton Nov 11, 2019
f5fe499
Add layout CSS for product results (#14017)
bluefuton Nov 12, 2019
908c215
Instant Search: Add error/offline handling for API (#14125)
jsnmoon Nov 27, 2019
de00c33
Instant Search: move date into new component and use <time> element (…
bluefuton Nov 28, 2019
33edb51
Instant Search: improve display of matching comments (#14132)
bluefuton Nov 28, 2019
2802e90
Instant Search: add label and button to search box (#13875)
bluefuton Nov 3, 2019
cfad28b
Instant Search: Ignore empty query values for filters (#13934)
jsnmoon Nov 4, 2019
1aa5102
Instant Search: Pay down technical debt (#13847)
jsnmoon Nov 4, 2019
5133bc7
Instant Search: Standardize class and ID prefixes (#13933)
jsnmoon Nov 4, 2019
fff93d8
Instant Search: Improve accessibility (#13884)
jsnmoon Nov 5, 2019
cd1ff44
Instant Search: only show multiple image icon for posts with gallery …
bluefuton Nov 6, 2019
78c63da
Add testing instructions to README (#13969)
bluefuton Nov 6, 2019
30f5d0c
Instant search: add product result component (#13826)
bluefuton Nov 7, 2019
a4438c1
Instant Search: Restore caching to API requests (#13981)
jsnmoon Nov 7, 2019
f9203b8
Instant Search: add basic Photon support (#13998)
bluefuton Nov 11, 2019
5563cd6
Add layout CSS for product results (#14017)
bluefuton Nov 12, 2019
c9fd139
Instant Search: Add error/offline handling for API (#14125)
jsnmoon Nov 27, 2019
2e1db00
Instant Search: move date into new component and use <time> element (…
bluefuton Nov 28, 2019
478cd6f
Instant Search: improve display of matching comments (#14132)
bluefuton Nov 28, 2019
ee28a5b
Merge branch 'instant-search-master' of github.com:Automattic/jetpack…
gibrown Dec 2, 2019
8d0a0d7
Instant Search: default to query string in `getResults()` (#13995)
bluefuton Dec 2, 2019
3523d2e
Instant Search: add search form to main content area (#14142)
bluefuton Dec 3, 2019
895626c
Instant Search: add filter icon toggle (#14176)
bluefuton Dec 10, 2019
6f07d1f
Instant Search: Improve UX for offline network state (#14189)
jsnmoon Dec 10, 2019
b481984
Instant Search: try using an overlay (#14205)
bluefuton Dec 16, 2019
49d06e8
Instant Search: setup preact-testing-library (#13950)
bluefuton Dec 19, 2019
8be3b44
Instant Search: Port bug fixes from #14247
Dec 20, 2019
336413e
Merge remote-tracking branch 'origin/master' into instant-search-master
Dec 20, 2019
1af22dc
Add basic build process to README.
gibrown Jan 3, 2020
07095b2
Instant Search: trigger overlay on submit (#14248)
bluefuton Jan 7, 2020
6806c69
Instant Search: Add sidebar widget area (#14283)
jsnmoon Jan 7, 2020
584d61a
Instant Search: refactor search php for the different experiences (#1…
gibrown Jan 9, 2020
9a315b6
Instant Search: fix Esc key behaviour (#14312)
bluefuton Jan 9, 2020
5116f88
Instant Search: Add search filtering inside overlay (#14319)
jsnmoon Jan 14, 2020
dc7176d
Instant search: introduce overlay from right (#14339)
bluefuton Jan 15, 2020
bc801fb
Use the posts_per_page setting to decide how many posts to retrieve (…
bluefuton Jan 16, 2020
fcc6447
Instant Search: Use widgets inside overlay for filtering (#14374)
jsnmoon Jan 17, 2020
2db1ef0
Instant Search: update overlay styles (#14379)
keoshi Jan 20, 2020
8dd97ba
Instant Search: Fix taxonomy name compilation bug (#14408)
jsnmoon Jan 21, 2020
d155a7b
Instant Search: Fix date formatting issue for filters (#14409)
jsnmoon Jan 21, 2020
92a6169
Instant Search: Integrate customizer options (#14427)
jsnmoon Jan 22, 2020
a065ba8
Update spacing on offline notice (#14419)
keoshi Jan 22, 2020
1dcecc0
Instant Search: add dark theme styles (#14429)
keoshi Jan 24, 2020
1a5ac6a
Fix filter toggle and integrate with widget area (#14451)
jsnmoon Jan 24, 2020
a9bc1bd
Instant Search: Improve search form detection (#14474)
jsnmoon Jan 24, 2020
f42480e
Instant Search: Prevent body scroll with overlay open (#14478)
jsnmoon Jan 27, 2020
7c3e207
Instant Search: Move focus into overlay input (#14477)
jsnmoon Jan 27, 2020
607dbb3
Instant Search: use taxonomy name rather than slug for filters (#14437)
bluefuton Jan 27, 2020
fbb8c6f
Fix filter formatting in Zerif Lite (#14493)
bluefuton Jan 28, 2020
a7a8fe3
Instant Search: switch to use .slug_slash_name for displaying custom …
bluefuton Jan 28, 2020
b22aeb9
Instant Search: Hotfix body scrolling behavior
Jan 28, 2020
603677e
Instant Search: Apply customizer changes without page reload (#14504)
jsnmoon Jan 28, 2020
409d420
Instant Search : Update mobile structure (#14423)
keoshi Jan 28, 2020
efabb3f
Instant Search: Restore initial href upon closing overlay (#14518)
jsnmoon Jan 30, 2020
eab1d5e
Instant Search: Restore focus to activeElement (#14522)
jsnmoon Jan 30, 2020
2448d2a
Search: Front end search filters open overlay (#14448)
gibrown Jan 30, 2020
95535d5
Instant search: add "powered by Jetpack" message (#14519)
bluefuton Jan 31, 2020
2c1eb19
Merge branch 'master' of github.com:Automattic/jetpack into instant-s…
Jan 31, 2020
1febfbd
Instant Search: Clear search and filter queries when necessary (#14533)
jsnmoon Feb 1, 2020
3f6b70c
Instant Search: Refine TrainTracks integration (#14587)
jsnmoon Feb 6, 2020
6e1835e
Instant Search: Fix broken dates in iOS Chrome (#14586)
jsnmoon Feb 7, 2020
b11afef
Merge branch 'master' of github.com:Automattic/jetpack into instant-s…
Feb 7, 2020
e7ff6cb
Instant Search: Update list of widgets passed to JS client (#14596)
jsnmoon Feb 10, 2020
51fb046
Instant Search: Escape wp_json_encode
Feb 11, 2020
6f434c3
Instant Search: Add missing translation calls
Feb 11, 2020
b9d64ce
Update escaping from code review.
gibrown Feb 11, 2020
cfc93e2
Instant Search: Fix unit tests
Feb 11, 2020
855921c
Instant Search: Fix ESLint errors
Feb 11, 2020
e67c601
Instant Search: Add files to PHPCS whitelist
Feb 11, 2020
e249563
Merge branch 'master' of github.com:Automattic/jetpack into instant-s…
Feb 12, 2020
99736fe
Instant Search: Add Jetpack Search gridicon (#14629)
jsnmoon Feb 12, 2020
2c1c0df
Instant Search: Hotfix customizer highlight color
Feb 13, 2020
ebf2390
Instant Search: Update TrainTracks to add session_id event property (…
Feb 13, 2020
13f4bc1
Ensures widgets included in the overlay are full width (#14670)
keoshi Feb 13, 2020
ebe0cf2
Prevents the load more button from being cut off in some themes (#14669)
keoshi Feb 13, 2020
8c5d6bb
Instant Search: remove date from search results (#14665)
keoshi Feb 13, 2020
985e228
Add locale prefix to jetpack.com link. (#14637)
gibrown Feb 14, 2020
1e3f25f
Instant Search: Address review feedback from master merge (#14659)
jsnmoon Feb 14, 2020
3f0ee3b
Hot fix for search css not building
gibrown Feb 18, 2020
8b40130
Pass locale props to JetpackColophon on mobile (#14709)
keoshi Feb 18, 2020
2c76931
Instant Search: update input box and icon styles (#14664)
keoshi Feb 19, 2020
e217142
Instant Search: change visual on close button (#14680)
keoshi Feb 19, 2020
503ba95
Instant Search: Hide mobile filters after applying filters (#14691)
jsnmoon Feb 19, 2020
99bc596
Instant Search: Properly handle numerical searches (#14692)
jsnmoon Feb 19, 2020
c93bf4d
Instant Search: add more styling specificity to search input (#14661)
keoshi Feb 20, 2020
ce477ec
Instant Search: use link to clear filters instead of button (#14744)
keoshi Feb 21, 2020
838e43e
Instant Search: improve grid structure in overlay (#14745)
keoshi Feb 21, 2020
9522da2
Instant Search: updates behavior and styling of filtering options (#1…
keoshi Feb 21, 2020
9f8c169
Remove unused showLogo property
Feb 21, 2020
4046871
Merge branch 'master' of github.com:Automattic/jetpack into instant-s…
Feb 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Instant Search: updates behavior and styling of filtering options (#1…
…4711)

Sorting buttons and "Filter" button drop down on mobile.

Co-authored-by: Jason Moon <4044428+jsnmoon@users.noreply.github.com>
Co-authored-by: Greg Ichneumon Brown <gbrown5878@gmail.com>
  • Loading branch information
3 people authored Feb 21, 2020
commit 9522da2edaf85a9cf2ac3deebb40423688b4f17c
8 changes: 8 additions & 0 deletions modules/search/instant-search/components/gridicon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Gridicon extends Component {
return <title>{ __( 'Is an event.', 'jetpack' ) }</title>;
case 'gridicons-cart':
return <title>{ __( 'Is a product.', 'jetpack' ) }</title>;
case 'chevron-down':
return <title>{ __( 'Show filters', 'jetpack' ) }</title>;
case 'gridicons-comment':
return <title>{ __( 'Matching comment.', 'jetpack' ) }</title>;
case 'gridicons-cross':
Expand Down Expand Up @@ -86,6 +88,12 @@ class Gridicon extends Component {
<path d="M9 20c0 1.1-.9 2-2 2s-1.99-.9-1.99-2S5.9 18 7 18s2 .9 2 2zm8-2c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm.396-5c.937 0 1.75-.65 1.952-1.566L21 5H7V4c0-1.105-.895-2-2-2H3v2h2v11c0 1.105.895 2 2 2h12c0-1.105-.895-2-2-2H7v-2h10.396z" />
</g>
);
case 'gridicons-chevron-down':
return (
<g>
<path d="M20 9l-8 8-8-8 1.414-1.414L12 14.172l6.586-6.586" />
</g>
);
case 'gridicons-comment':
return (
<g>
Expand Down
82 changes: 48 additions & 34 deletions modules/search/instant-search/components/search-box.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* External dependencies
*/
import { h } from 'preact';
import { h, Fragment } from 'preact';
import { useState, useEffect, useRef } from 'preact/hooks';
import { __ } from '@wordpress/i18n';
// eslint-disable-next-line lodash/import-scope
Expand All @@ -13,6 +13,8 @@ import uniqueId from 'lodash/uniqueId';
* Internal dependencies
*/
import Gridicon from './gridicon';
import SearchSort from './search-sort';
import { getSortQuery } from '../lib/query-string';

let initiallyFocusedElement = null;

Expand Down Expand Up @@ -47,42 +49,54 @@ const SearchBox = props => {
}, [] );

return (
<div className="jetpack-instant-search__box">
{ /* TODO: Add support for preserving label text */ }
<label className="jetpack-instant-search__box-label" htmlFor={ inputId }>
<span className="screen-reader-text">{ __( 'Site Search', 'jetpack' ) }</span>
<div className="jetpack-instant-search__box-gridicon">
<Gridicon icon="search" size={ 24 } />
</div>
<input
id={ inputId }
className="search-field jetpack-instant-search__box-input"
onInput={ props.onChangeQuery }
ref={ inputRef }
placeholder={ __( 'Search…', 'jetpack' ) }
type="search"
value={ props.query }
/>
</label>
<Fragment>
<div className="jetpack-instant-search__box">
{ /* TODO: Add support for preserving label text */ }
<label className="jetpack-instant-search__box-label" htmlFor={ inputId }>
<span className="screen-reader-text">{ __( 'Site Search', 'jetpack' ) }</span>
<div className="jetpack-instant-search__box-gridicon">
<Gridicon icon="search" size={ 24 } />
</div>
<input
id={ inputId }
className="search-field jetpack-instant-search__box-input"
onInput={ props.onChangeQuery }
ref={ inputRef }
placeholder={ __( 'Search…', 'jetpack' ) }
type="search"
value={ props.query }
/>

<button className="screen-reader-text">{ __( 'Search', 'jetpack' ) }</button>
</label>
</div>

{ props.enableFilters && ! props.widget && (
/* Using role='button' rather than button element so we retain control over styling */
<div
role="button"
onClick={ props.toggleFilters }
onKeyDown={ props.toggleFilters }
tabIndex="0"
className="jetpack-instant-search__box-filter-icon"
>
<Gridicon icon="filter" alt="Search filter icon" aria-hidden="true" />
<span class="screen-reader-text">
{ props.showFilters
? __( 'Hide filters', 'jetpack' )
: __( 'Show filters', 'jetpack' ) }
</span>
<div className="jetpack-instant-search__box-filter-area">
<div
role="button"
onClick={ props.toggleFilters }
onKeyDown={ props.toggleFilters }
tabIndex="0"
className="jetpack-instant-search__box-filter-button"
>
{ __( 'Filters', 'jetpack' ) }
<Gridicon
icon="chevron-down"
size={ 16 }
alt="Show search filters"
aria-hidden="true"
/>
<span className="screen-reader-text">
{ props.showFilters
? __( 'Hide filters', 'jetpack' )
: __( 'Show filters', 'jetpack' ) }
</span>
</div>
<SearchSort onChange={ props.onChangeSort } value={ getSortQuery() } />
</div>
) }
<button className="screen-reader-text">{ __( 'Search', 'jetpack' ) }</button>
</div>
</Fragment>
);
};

Expand Down
107 changes: 105 additions & 2 deletions modules/search/instant-search/components/search-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,116 @@ input.jetpack-instant-search__box-input.search-field {
}
}

.jetpack-instant-search__box-filter-icon {
margin: 0 16px;
.jetpack-instant-search__box-filter-area {
display: flex;
align-items: center;
margin-top: 12px;
}

.jetpack-instant-search__box-filter-button,
.jetpack-instant-search__box-filter-option {
padding: 8px;
font-size: 12px;
border: 1px solid #8e8e8e;
text-decoration: none;
transition: background-color 0.25s ease-in-out;

@include break-small() {
padding: 10px 14px;
font-size: 13px;
}

.jetpack-instant-search__overlay--light & {
color: #000;
}

.jetpack-instant-search__overlay--dark & {
color: #fff;
}
}

.jetpack-instant-search__box-filter-button {
display: flex;
align-items: center;
margin-right: 6px;
border-radius: 5px;
cursor: pointer;

@include break-small() {
margin-right: 16px;
}

@include break-medium() {
display: none;
}

&:hover,
&:focus {
.jetpack-instant-search__overlay--light & {
background-color: #d2d2d2;
}

.jetpack-instant-search__overlay--dark & {
background-color: #4f4f4f;
}
}

.gridicon {
margin-left: 4px;
}
}

.jetpack-instant-search__box-filter-order {
display: flex;
}

.jetpack-instant-search__box-filter-option {
border: 1px solid #8e8e8e;
border-right-width: 0;
cursor: pointer;

&:first-of-type {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}

&:last-of-type {
border-right-width: 1px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}

&.is-selected,
&:hover,
&:focus {
.jetpack-instant-search__overlay--light & {
background-color: #d2d2d2;
}

.jetpack-instant-search__overlay--dark & {
background-color: #4f4f4f;
}
}

&.is-selected {
.jetpack-instant-search__overlay--light & {
border-color: #000;
}

.jetpack-instant-search__overlay--dark & {
border-color: #d4d4d4;
}

& + .jetpack-instant-search__box-filter-option {
.jetpack-instant-search__overlay--light & {
border-left: 1px solid #000;
}

.jetpack-instant-search__overlay--dark & {
border-left: 1px solid #d4d4d4;
}
}
}
}

/* apply to all the inputs to try and pick up any theme styling */
Expand Down
13 changes: 3 additions & 10 deletions modules/search/instant-search/components/search-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ import { Component, h } from 'preact';
import JetpackColophon from './jetpack-colophon';
import SearchBox from './search-box';
import SearchFilters from './search-filters';
import SearchSort from './search-sort';

import {
getFilterQuery,
getSearchQuery,
getSortQuery,
setSearchQuery,
setSortQuery,
} from '../lib/query-string';
import { getFilterQuery, getSearchQuery, setSearchQuery, setSortQuery } from '../lib/query-string';

const noop = event => event.preventDefault();

Expand Down Expand Up @@ -51,10 +44,11 @@ class SearchForm extends Component {
render() {
return (
<form onSubmit={ noop } role="search" className={ this.props.className }>
<div className="search-form jetpack-instant-search__search-form">
<div className="jetpack-instant-search__search-form">
<SearchBox
enableFilters
onChangeQuery={ this.onChangeQuery }
onChangeSort={ this.onChangeSort }
query={ getSearchQuery() }
showFilters={ this.state.showFilters }
toggleFilters={ this.toggleFilters }
Expand All @@ -64,7 +58,6 @@ class SearchForm extends Component {
{ this.state.showFilters && (
<div className="jetpack-instant-search__search-form-filters">
<div className="jetpack-instant-search__search-form-filters-arrow" />
<SearchSort onChange={ this.onChangeSort } value={ getSortQuery() } />
{ this.props.widgets.map( widget => (
<SearchFilters
filters={ getFilterQuery() }
Expand Down
6 changes: 3 additions & 3 deletions modules/search/instant-search/components/search-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ $arrow-height: 10px;

.jetpack-instant-search__search-form-filters {
position: absolute;
top: 52px;
right: 0;
top: 96px;
left: 0;
z-index: 10;
width: 100%;
margin: 12px 0 32px;
Expand Down Expand Up @@ -43,7 +43,7 @@ $arrow-height: 10px;
.jetpack-instant-search__search-form-filters-arrow {
position: absolute;
top: ( $arrow-height + 1px ) * -1;
right: 16px;
left: 52px;
width: $arrow-height * 2;
height: $arrow-height;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
z-index: 10;
max-width: 1080px;
margin: 0 auto;
padding: 0 0.5em;
padding: 0.125em 0.5em;
text-align: left;

mark {
Expand Down
45 changes: 25 additions & 20 deletions modules/search/instant-search/components/search-sort.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,45 @@
* External dependencies
*/
import { h, Component } from 'preact';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import { getSortOptions } from '../lib/sort';

export default class SearchSort extends Component {
handleChange = event => {
if ( this.props.value === event.target.value ) {
return;
handleKeyPress = event => {
if ( this.props.value !== event.target.value && event.key === 'Enter' ) {
event.preventDefault();
this.props.onChange( event.target.dataset.value );
}
};
handleClick = event => {
if ( this.props.value !== event.target.value ) {
event.preventDefault();
this.props.onChange( event.target.dataset.value );
}

this.props.onChange( event.target.value );
};

render() {
const sortOptions = getSortOptions();
return (
<div className="jetpack-instant-search__sort">
<label>
<span>{ __( 'Sort by', 'jetpack' ) }</span>
<select
className="jetpack-instant-search__sort-select"
onBlur={ this.handleChange }
onChange={ this.handleChange }
<div className="jetpack-instant-search__box-filter-order">
{ Object.keys( sortOptions ).map( sortKey => (
<a
class={ `jetpack-instant-search__box-filter-option ${
this.props.value === sortKey ? 'is-selected' : ''
}` }
data-value={ sortKey }
key={ sortKey }
onClick={ this.handleClick }
onKeyPress={ this.handleKeyPress }
role="button"
tabIndex={ 0 }
>
{ Object.keys( sortOptions ).map( sortKey => (
<option value={ sortKey } selected={ this.props.value === sortKey }>
{ sortOptions[ sortKey ].label }
</option>
) ) }
</select>
</label>
{ sortOptions[ sortKey ].label }
</a>
) ) }
</div>
);
}
Expand Down
13 changes: 0 additions & 13 deletions modules/search/instant-search/components/search-sort.scss

This file was deleted.

Loading