-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add desktop view for search (fix #2560)
- Loading branch information
Showing
24 changed files
with
720 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@import "~amo/css/inc/vars"; | ||
@import "~core/css/inc/mixins"; | ||
@import "~ui/css/vars"; | ||
|
||
@include respond-to(large) { | ||
ul.AddonsCard-list { | ||
display: grid; | ||
grid-auto-flow: column dense; | ||
grid-template-columns: 50% 50%; | ||
|
||
.SearchResult { | ||
background: $white; | ||
grid-column: 1 / -1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,56 @@ | ||
@import "~amo/css/inc/vars"; | ||
@import "~core/css/inc/mixins"; | ||
|
||
.Search { | ||
padding: $padding-page $padding-page 0; | ||
@include respond-to(large) { | ||
display: grid; | ||
grid-auto-flow: column dense; | ||
grid-gap: 10px; | ||
grid-template-columns: minmax(300px, 35%) auto; | ||
padding: $padding-page; | ||
} | ||
|
||
.Card { | ||
margin: $padding-page; | ||
|
||
@include respond-to(large) { | ||
margin: 0; | ||
} | ||
} | ||
|
||
.SearchSort { | ||
margin: $padding-page; | ||
|
||
@include respond-to(large) { | ||
margin: 0; | ||
} | ||
} | ||
|
||
.SearchContextCard { | ||
@include respond-to(large) { | ||
grid-column: 1 / -1; | ||
grid-row: 1; | ||
} | ||
} | ||
|
||
.SearchSort { | ||
@include respond-to(large) { | ||
grid-column: 1 / 2; | ||
grid-row: 2; | ||
} | ||
} | ||
|
||
.SearchResults { | ||
@include respond-to(large) { | ||
grid-column: 2; | ||
grid-row: 2 / 4; | ||
} | ||
} | ||
|
||
.Paginate { | ||
@include respond-to(large) { | ||
grid-column: 1 / -1; | ||
grid-row: 4; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { compose } from 'redux'; | ||
|
||
import translate from 'core/i18n/translate'; | ||
import Card from 'ui/components/Card'; | ||
|
||
import './styles.scss'; | ||
|
||
|
||
export class SearchContextCardBase extends React.Component { | ||
static propTypes = { | ||
count: PropTypes.number, | ||
filters: PropTypes.object, | ||
i18n: PropTypes.object.isRequired, | ||
loading: PropTypes.bool.isRequired, | ||
} | ||
|
||
static defaultProps = { | ||
count: 0, | ||
filters: {}, | ||
} | ||
|
||
render() { | ||
const { count, filters, i18n, loading } = this.props; | ||
const { query } = filters; | ||
|
||
let searchText; | ||
|
||
if (!loading && query) { | ||
searchText = i18n.sprintf(i18n.ngettext( | ||
'%(count)s result for "%(query)s"', | ||
'%(count)s results for "%(query)s"', | ||
count), { count: i18n.formatNumber(count), query } | ||
); | ||
} else if (loading && query) { | ||
searchText = i18n.sprintf(i18n.gettext( | ||
'Searching for "%(query)s"'), { query }); | ||
} else if (loading) { | ||
searchText = i18n.gettext('Loading add-ons'); | ||
} else if (!loading && count === 0) { | ||
searchText = i18n.gettext('No add-ons found'); | ||
} else { | ||
searchText = i18n.sprintf(i18n.ngettext( | ||
'%(count)s add-on found"', | ||
'%(count)s add-ons found', | ||
count), { count: i18n.formatNumber(count) } | ||
); | ||
} | ||
|
||
return ( | ||
<Card className="SearchContextCard"> | ||
<h1 className="SearchContextCard-header">{searchText}</h1> | ||
</Card> | ||
); | ||
} | ||
} | ||
|
||
export function mapStateToProps(state) { | ||
return { | ||
count: state.search.count, | ||
filters: state.search.filters, | ||
loading: state.search.loading, | ||
}; | ||
} | ||
|
||
export default compose( | ||
connect(mapStateToProps), | ||
translate(), | ||
)(SearchContextCardBase); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import "~ui/css/vars"; | ||
|
||
.SearchContextCard-header { | ||
font-size: $font-size-l; | ||
margin: 0; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.