Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

202 mobile search changes #230

Merged
merged 14 commits into from
May 19, 2020
Merged
6 changes: 5 additions & 1 deletion assets/css/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
*:focus {
outline: none;
}

:root {
font-family: Verdana, sans-serif;
line-height: 1.6em;
}
// NOTE: chrome specific
// https://stackoverflow.com/questions/9328832/how-to-apply-specific-css-rules-to-chrome-only
.selector:not(*:root), :root {
font-size: 0.85em;
}
.site-header {
position: fixed;
left: 0;
Expand Down
18 changes: 18 additions & 0 deletions assets/css/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
grid-column-gap: 0;
grid-template-rows: auto;
padding: 1em;
min-height:0;
padding-right: 0.5em;
}
.search-container main {
padding: 0;
Expand All @@ -53,4 +55,20 @@
grid-row-start: 2;
background-color: var(--lightNeutralColor);
}
.search-container vivo-filter-clearer {
display: none;
}

.search-container vivo-facet-group-toggle {
float:right;
height: 1em;
}

.search-container vivo-tab {
width: 85%;
color: var(--textColor);
padding-top:0;
padding-left: 0;
border-top: none;
}
}
1 change: 0 additions & 1 deletion assets/js/elements/tab-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class TabPanel extends LitElement {
}

:host([vivo-tab-style="secondary"]) {
border-top: 1px solid var(--mediumNeutralColor);
border-top: none;
}
@media (max-width: 45em) {
Expand Down
1 change: 0 additions & 1 deletion assets/js/elements/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Tab extends LitElement {
opacity: 100%;
}


.fas { display: none; }
@media (max-width: 45em) {
.fas {
Expand Down
50 changes: 33 additions & 17 deletions assets/js/search/facet-group-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SearchFacetGroupToggle extends LitElement {
super();
this.shown = false;
this.handleToggleFilters = this.handleToggleFilters.bind(this);
this.handleClearFilters = this.handleClearFilters.bind(this);
}

static get styles() {
Expand All @@ -25,30 +26,41 @@ class SearchFacetGroupToggle extends LitElement {
a:hover {
cursor: pointer;
}

@media screen and (max-width: 1000px) {
:host { display: inline; }
:host { display: block; }
div { display: flex; }
:host ::slotted([slot=clear]) {
display:none;
}
:host([shown]) {
display:block;
width: 100%;
}
:host .fa-filter::before {
font-family: 'Font Awesome 5 Free';
font-weight: 900;
content: "\\f0b0";
font-style: normal;
}
:host ::slotted([slot="show"]) {
display: inline;
}
:host ::slotted([slot="hide"]) {
display: none;
}
:host([shown]) ::slotted([slot="show"]) {
display: none;
}
:host([shown]) ::slotted([slot="hide"]) {
display: inline;
:host([shown]) ::slotted([slot=clear]) {
display:block;
flex-grow: 4;
font-weight: bold;
}
}
`
}

handleClearFilters(e) {
this.dispatchEvent(new CustomEvent('removeFilters', {
detail: { clear: true }, // not sure what to put
bubbles: true,
cancelable: false,
composed: true
}));
}

handleToggleFilters(e) {
this.dispatchEvent(new CustomEvent('toggleFilters', {
detail: { show: !this.shown }, // not sure what to put
Expand All @@ -57,15 +69,19 @@ class SearchFacetGroupToggle extends LitElement {
composed: true
}));
this.shown = !this.shown;

this.toggleOptions();
}

render() {
return html`
<button @click="${this.handleToggleFilters}">
<i class="fas fa-filter"></i>
<slot name="show"></slot>
<slot name="hide"></slot>
</button>`
<div>
<slot name="clear" @click="${this.handleClearFilters}"></slot>
<button @click="${this.handleToggleFilters}">
<i class="fas fa-filter"></i>
</button>
</div>
`
}
}

Expand Down
2 changes: 1 addition & 1 deletion assets/js/search/facet-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class FacetPopupBox extends Faceter(LitElement) {
overflow-x: hidden;
scrollbar-base-color:#ffeaff;
min-height: unset;
max-height: 85%;
max-height: 65%;
font-size: unset;
}
}
Expand Down
21 changes: 21 additions & 0 deletions assets/js/search/grants/grant-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,27 @@ class GrantSearch extends Searcher(LitElement) {
.grants {
padding: 1em;
}
@media screen and (max-width: 1000px) {
.grants {
padding-left: 0;
padding-right: 0;
}
.search-actions {
display: flex;
flex-direction: column;
padding-left: 0;
padding-right: 0;
}
::slotted(vivo-search-sort-options) {
flex-basis: auto;
flex-grow: 1;
text-align: left;
}
::slotted(vivo-pagination-summary) {
flex-basis; auto;
flex-grow: 1;
}
}
`
}

Expand Down
11 changes: 11 additions & 0 deletions assets/js/search/pagination-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ class SearchPaginationSummary extends LitElement {
this.coordinator = this.closest('vivo-search-coordinator');
}

static get styles() {
return css`
@media screen and (max-width: 1000px) {
span {
display:none;
font-size: 0.85em;
}
}
`
}

render() {
let pagingText = html``;

Expand Down
9 changes: 9 additions & 0 deletions assets/js/search/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ class SearchPagination extends LitElement {
background-color: #337ab7;
color: #fff;
}
@media screen and (max-width: 1000px) {
:host {
font-size: 0.9em;
}
li a {
padding: 4px 10px;
}
}

`
}

Expand Down
42 changes: 24 additions & 18 deletions assets/js/search/people/person-image.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
import { LitElement, html, css } from "lit-element";

class PersonImage extends LitElement {
static get properties() {
return {
thumbnail: { type: String }
}
static get properties() {
return {
thumbnail: { type: String }
}

static get styles() {
return css`
}

static get styles() {
return css`
.img-thumbnail {
border: 3px solid #F3F2F1;
width: 130px;
}

@media screen and (max-width: 1000px) {
.img-thumbnail {
width: 110px;
}
}
`
}
render() {
// TODO: how to get 'assetPath' in here?
var url = `${defaultProfileImage}`;

if (this.thumbnail != "null") {
url = `${this.thumbnail}`;
}
return html`
<img class="img-thumbnail" width="130" src="${url}" />
`
render() {
var url = `${defaultProfileImage}`;

if (this.thumbnail != "null") {
url = `${this.thumbnail}`;
}
return html`
<img class="img-thumbnail" src="${url}" />
`
}
customElements.define('vivo-person-card-image', PersonImage);
}
customElements.define('vivo-person-card-image', PersonImage);
21 changes: 21 additions & 0 deletions assets/js/search/people/person-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ class PersonSearch extends Searcher(LitElement) {
#overview {
width: 75%;
}
@media screen and (max-width: 1000px) {
.people {
padding-left: 0;
padding-right: 0;
}
.search-actions {
display: flex;
flex-direction: column;
padding-left: 0;
padding-right: 0;
}
::slotted(vivo-search-sort-options) {
flex-basis: auto;
flex-grow: 1;
text-align: left;
}
::slotted(vivo-pagination-summary) {
flex-basis; auto;
flex-grow: 1;
}
}
`
}

Expand Down
21 changes: 21 additions & 0 deletions assets/js/search/publications/publication-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ class PublicationSearch extends Searcher(LitElement) {
flex-basis:35%;
text-align: right;
}
@media screen and (max-width: 1000px) {
.publications {
padding-left: 0;
padding-right: 0;
}
.search-actions {
display: flex;
flex-direction: column;
padding-left: 0;
padding-right: 0;
}
::slotted(vivo-search-sort-options) {
flex-basis: auto;
flex-grow: 1;
text-align: left;
}
::slotted(vivo-pagination-summary) {
flex-basis; auto;
flex-grow: 1;
}
}
`
}

Expand Down
8 changes: 8 additions & 0 deletions locales/all.de-de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,11 @@
translation: "von"
- id: filter_authors
translation: "Filter Autoren"
- id: filter
translation: "Filter"
- id: show
translation: "Anzeigen"
- id: hide
translation: "Verbergen"
- id: reset
translation: "Zurücksetzen"
8 changes: 8 additions & 0 deletions locales/all.en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,12 @@
translation: "of"
- id: filter_authors
translation: "Filter Authors"
- id: filter
translation: "Filter"
- id: show
translation: "Show"
- id: hide
translation: "Hide"
- id: reset
translation: "Reset"

10 changes: 9 additions & 1 deletion locales/all.fr-fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,13 @@
- id: date_descending
translation: "Date (décroissant)"
- id: filter_authors
translation: "filtre Auteurs"
translation: "Filtre Auteurs"
- id: filter
translation: "Filtre"
- id: show
translation: "Afficher"
- id: hide
translation: "Masquer"
- id: reset
translation: "Réinitialiser"

8 changes: 8 additions & 0 deletions locales/all.it-it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,11 @@
translation: "Data (decrescente)"
- id: filter_authors
translation: "Filtro Autori"
- id: filter
translation: "Filtro"
- id: show
translation: "Mostra"
- id: hide
translation: "Nascondi"
- id: reset
translation: "Ripristina"
5 changes: 3 additions & 2 deletions templates/search_pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ <h4><%= t("funding_source") %></h4>

<!-- NOTE: only seen on smaller screens -->
<vivo-facet-group-toggle>
<span slot="show"><%= t("show_filters") %></span>
<span slot="hide"><%= t("hide_filters") %></span>
<div slot="clear">
<span>&lt; <%= t("reset_search_filters") %></span>
</div>
</vivo-facet-group-toggle>

<vivo-tabs id="all-search-tabs" vivo-tab-style="secondary">
Expand Down