Refactor search input, navbar

- fix search input width on desktop
- removed adding removing classes on focus/blur search input
- fix notifications dropdown on mobile

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
This commit is contained in:
Matt Rider 2019-07-15 11:20:28 -03:00
parent b0f999ac05
commit bb4532827a
3 changed files with 11 additions and 22 deletions

View File

@ -22,8 +22,8 @@ export default {
FilterPostsMenuItems, FilterPostsMenuItems,
}, },
props: { props: {
placement: { type: String, default: 'bottom-start' }, placement: { type: String },
offset: { type: [String, Number], default: '16' }, offset: { type: [String, Number] },
categories: { type: Array, default: () => [] }, categories: { type: Array, default: () => [] },
}, },
data() { data() {

View File

@ -2,7 +2,7 @@
<ds-button v-if="totalNotifications <= 0" class="notifications-menu" disabled icon="bell"> <ds-button v-if="totalNotifications <= 0" class="notifications-menu" disabled icon="bell">
{{ totalNotifications }} {{ totalNotifications }}
</ds-button> </ds-button>
<dropdown v-else class="notifications-menu"> <dropdown v-else class="notifications-menu" :placement="placement">
<template slot="default" slot-scope="{ toggleMenu }"> <template slot="default" slot-scope="{ toggleMenu }">
<ds-button primary icon="bell" @click.prevent="toggleMenu"> <ds-button primary icon="bell" @click.prevent="toggleMenu">
{{ totalNotifications }} {{ totalNotifications }}
@ -48,6 +48,9 @@ export default {
NotificationList, NotificationList,
Dropdown, Dropdown,
}, },
props: {
placement: { type: String },
},
computed: { computed: {
totalNotifications() { totalNotifications() {
return (this.notifications || []).length return (this.notifications || []).length

View File

@ -17,10 +17,10 @@
<ds-button icon="bars" @click="toggleMobileMenuView" right /> <ds-button icon="bars" @click="toggleMobileMenuView" right />
</ds-flex-item> </ds-flex-item>
<ds-flex-item <ds-flex-item
:width="{ base: '100%', sm: '100%', md: '50%', lg: '50%' }" :width="{ base: '85%', sm: '85%', md: '50%', lg: '50%' }"
:class="{ 'hide-mobile-menu': !toggleMobileMenu }" :class="{ 'hide-mobile-menu': !toggleMobileMenu }"
> >
<div id="nav-search-box" v-on:click="unfolded" @blur.capture="foldedup"> <div id="nav-search-box">
<search-input <search-input
id="nav-search" id="nav-search"
:delay="300" :delay="300"
@ -33,7 +33,7 @@
</div> </div>
</ds-flex-item> </ds-flex-item>
<ds-flex-item <ds-flex-item
:width="{ base: '100%', sm: '100%', md: '10%', lg: '10%' }" :width="{ base: '15%', sm: '15%', md: '10%', lg: '10%' }"
:class="{ 'hide-mobile-menu': !toggleMobileMenu }" :class="{ 'hide-mobile-menu': !toggleMobileMenu }"
> >
<no-ssr> <no-ssr>
@ -58,7 +58,7 @@
</no-ssr> </no-ssr>
<template v-if="isLoggedIn"> <template v-if="isLoggedIn">
<no-ssr> <no-ssr>
<notification-menu /> <notification-menu placement="top" />
</no-ssr> </no-ssr>
<no-ssr> <no-ssr>
<dropdown class="avatar-menu" offset="8"> <dropdown class="avatar-menu" offset="8">
@ -240,12 +240,6 @@ export default {
} }
return this.$route.path.indexOf(url) === 0 return this.$route.path.indexOf(url) === 0
}, },
unfolded: function() {
document.getElementById('nav-search-box').classList.add('unfolded')
},
foldedup: function() {
document.getElementById('nav-search-box').classList.remove('unfolded')
},
toggleMobileMenuView() { toggleMobileMenuView() {
this.toggleMobileMenu = !this.toggleMobileMenu this.toggleMobileMenu = !this.toggleMobileMenu
}, },
@ -264,14 +258,6 @@ export default {
}, },
} }
</script> </script>
<style>
.unfolded {
position: absolute;
right: 0px;
left: 0px;
z-index: 1;
}
</style>
<style lang="scss"> <style lang="scss">
.topbar-locale-switch { .topbar-locale-switch {
@ -283,7 +269,7 @@ export default {
.main-container { .main-container {
padding-top: 6rem; padding-top: 6rem;
padding-botton: 5rem; padding-bottom: 5rem;
} }
.main-navigation { .main-navigation {