diff --git a/app/components/nav-bar.js b/app/components/nav-bar.js index be195e96e5d..4d0f1c8f2b2 100644 --- a/app/components/nav-bar.js +++ b/app/components/nav-bar.js @@ -9,6 +9,24 @@ export default class NavBar extends Component { return !(String(this.session.currentRouteName).includes('public')); } + @computed('session.currentRouteName') + get isNotExplorePageRoute() { + return !(String(this.session.currentRouteName).includes('explore')); + } + + @action + handleKeyPress() { + if (event.code === 'Enter') { + this.sendAction('search'); + document.querySelector('#mobile-bar').classList.remove('show-bar'); + } + } + + @action + toggleSearchBar() { + document.querySelector('#mobile-bar').classList.toggle('show-bar'); + } + @action logout() { this.authManager.logout(); diff --git a/app/components/side-bar.js b/app/components/side-bar.js index 7ab7710c0d3..346d1240f42 100644 --- a/app/components/side-bar.js +++ b/app/components/side-bar.js @@ -1,6 +1,7 @@ import classic from 'ember-classic-decorator'; import $ from 'jquery'; import Component from '@ember/component'; +import { action } from '@ember/object'; @classic export default class SideBar extends Component { @@ -14,6 +15,14 @@ export default class SideBar extends Component { this.set('sidebarVisible', false); } + @action + handleKeyPress() { + if (event.code === 'Enter') { + this.set('sidebarVisible', false); + this.sendAction('search'); + } + } + didInsertElement() { super.didInsertElement(...arguments); diff --git a/app/controllers/application.js b/app/controllers/application.js index f91a71507fe..bb3d9c6d9a2 100644 --- a/app/controllers/application.js +++ b/app/controllers/application.js @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service'; import { filterBy } from '@ember/object/computed'; import Controller from '@ember/controller'; import moment from 'moment'; +import { tracked } from '@glimmer/tracking'; @classic @@ -17,6 +18,8 @@ export default class ApplicationController extends Controller { @service fastboot; + @tracked event_name = null; + @filterBy('model.notifications', 'isRead', false) unreadNotifications; @@ -47,4 +50,10 @@ export default class ApplicationController extends Controller { this.getCookieSeen(true); this.showCookie = false; } + + @action + search() { + this.transitionToRoute('explore', { queryParams: { event_name: this.event_name } }); + this.event_name = null; + } } diff --git a/app/styles/libs/_helpers.scss b/app/styles/libs/_helpers.scss index 53bb7adbfad..502bed7728c 100644 --- a/app/styles/libs/_helpers.scss +++ b/app/styles/libs/_helpers.scss @@ -84,7 +84,7 @@ $spacer-heights: 50 100 200 300 400 500 600 700 800 900; } .space-between { - justify-content: space-between; + justify-content: space-between !important; } .flex-1 { diff --git a/app/styles/pages/events.scss b/app/styles/pages/events.scss index 0ffe2c2dee3..c1c4c6a801e 100644 --- a/app/styles/pages/events.scss +++ b/app/styles/pages/events.scss @@ -13,3 +13,51 @@ width: 100%; } } + +.search-bar { + + background-color: #fafafa; + border-radius: .5rem; + color: #808080; + + + input[type='text'] { + background-color: #fafafa; + border: 0; + outline: 0; + transition: width .2s ease-in-out; + width: 140px; + + &:focus { + width: 200px; + } + + } + + i { + margin-bottom: .5rem; + } + + &-mobile { + position: absolute; + left: 50%; + transform: translateX(-52%); + z-index: -1; + width: 20%; + transition: all .2s ease-in-out; + + input[type='text'] { + width: 100%; + + &:focus { + width: 100%; + } + } + + } +} + +.show-bar { + z-index: 1; + width: 80%; +} diff --git a/app/styles/partials/utils.scss b/app/styles/partials/utils.scss index bd97ba889f0..99a3706e830 100644 --- a/app/styles/partials/utils.scss +++ b/app/styles/partials/utils.scss @@ -49,6 +49,10 @@ padding: .25rem !important; } +.p-2 { + padding: .5rem !important; +} + .pt-1 { padding-top: .25rem !important; } diff --git a/app/templates/application.hbs b/app/templates/application.hbs index 0d030b7488a..c5845a5e5a1 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -9,11 +9,12 @@ {{/if}} {{/if}} - +