From c50c794e12e71a3b0726228d566148299f9d26ea Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Sat, 12 Jan 2019 17:39:33 +0100 Subject: [PATCH] Improved LocaleSwitch and Avatar Item in Topbar --- components/LocaleSwitch.vue | 83 +++++++++++++++++-------------------- layouts/default.vue | 10 ++--- 2 files changed, 42 insertions(+), 51 deletions(-) diff --git a/components/LocaleSwitch.vue b/components/LocaleSwitch.vue index 74e1a2d3b..707cfd53a 100644 --- a/components/LocaleSwitch.vue +++ b/components/LocaleSwitch.vue @@ -21,26 +21,24 @@ name="angle-down" /> - + + + {{ item.route.name }} + + @@ -65,12 +63,24 @@ export default { computed: { current() { return find(this.locales, { code: this.$i18n.locale() }) + }, + routes() { + let routes = this.locales.map(locale => { + return { + name: locale.name, + path: locale.code + } + }) + return routes } }, methods: { - changeLanguage(locale) { + changeLanguage(locale, toggleMenu) { this.$i18n.set(locale) - this.$refs.menu.toggleMenu() + toggleMenu() + }, + isExact(locale) { + return locale === this.$i18n.locale() } } } @@ -82,32 +92,15 @@ export default { display: flex; align-items: center; height: 100%; + padding: $space-xx-small; } -ul.locale-menu-popover { - list-style: none; - padding: 0; - margin: 0; +nav.locale-menu-popover { + margin-left: -$space-small !important; + margin-right: -$space-small !important; - li { - a { - opacity: 0.8; - - display: block; - padding: 0.3rem 0; - - img { - margin-right: 8px; - } - - &:hover { - opacity: 1; - } - &.active { - opacity: 1; - font-weight: bold; - } - } + a { + padding: $space-x-small $space-small; } } diff --git a/layouts/default.vue b/layouts/default.vue index 045bfb357..5756e1fa2 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -15,7 +15,6 @@