4
4
<div
5
5
class =" flex justify-between items-center py-2 flex-wrap lg:py-6 lg:space-x-10"
6
6
>
7
- <div class =" flex justify-between w-full lg:w-auto" >
7
+ <div v-if = " logo " class =" flex justify-between w-full lg:w-auto" >
8
8
<nuxt-link :to =" localePath('/')" class =" logo" >
9
- <img
10
- class =" h-8 w-auto sm:h-10"
11
- src =" @/assets/images/logo_landscape_white.png"
12
- alt =" Logo"
13
- />
9
+ <img class =" h-8 w-auto sm:h-10" :src =" logo" alt =" Logo" />
14
10
</nuxt-link >
15
11
</div >
16
12
<nav
13
+ v-if =" menu"
17
14
class =" lg:flex lg:flex-1 lg:justify-center lg:space-x-10 mt-2 lg:mt-0 w-screen lg:max-w-screen-md overflow-x-scroll overscroll-y-none whitespace-nowrap"
18
15
>
19
- <nuxt-link
20
- v-for =" menuItem in menu"
21
- :key =" menuItem.text"
22
- :to =" localePath(menuItem.link)"
23
- class =" text-base font-medium text-white hover:text-primary-700 text-center hover:border-primary-700 mr-3 lg:mr-0"
24
- >
25
- {{ $t(menuItem.text) }}
26
- </nuxt-link >
16
+ <template v-for =" item in menu " >
17
+ <nuxt-link
18
+ v-if =" item.link.linktype === 'story'"
19
+ :key =" item.name"
20
+ :to =" localePath(`/${item.link.url || item.link.cached_url}`)"
21
+ :target =" item.target"
22
+ class =" text-base font-medium text-white hover:text-primary-700 text-center hover:border-primary-700 mr-3 lg:mr-0"
23
+ >
24
+ {{ item.name }}
25
+ </nuxt-link >
26
+
27
+ <a
28
+ v-else
29
+ :key =" item.name"
30
+ :target =" item.target"
31
+ :href =" item.link.url || item.link.cached_url"
32
+ class =" text-base font-medium text-white hover:text-primary-700 text-center hover:border-primary-700 mr-3 lg:mr-0"
33
+ >
34
+ {{ item.name }}
35
+ </a >
36
+ </template >
27
37
</nav >
38
+ <div
39
+ v-if =" availableLocales && availableLocales.length > 0"
40
+ class =" flex items-center justify-end absolute right-0 top-1 lg:relative lg:w-0"
41
+ >
42
+ <t-dropdown
43
+ :fixedClasses =" {
44
+ button:
45
+ 'block px-4 py-2 text-white transition duration-100 ease-in-out bg-blue-500 border border-transparent rounded shadow-sm hover:bg-blue-600 focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none focus:ring-opacity-50 disabled:opacity-50 disabled:cursor-not-allowed',
46
+ wrapper: 'inline-flex flex-col',
47
+ dropdownWrapper: 'relative z-10',
48
+ dropdown:
49
+ 'origin-top-right absolute right-0 w-24 rounded shadow bg-white mt-1',
50
+ enterClass: 'opacity-0 scale-95',
51
+ enterActiveClass: 'transition transform ease-out duration-100',
52
+ enterToClass: 'opacity-100 scale-100',
53
+ leaveClass: 'opacity-100 scale-100',
54
+ leaveActiveClass: 'transition transform ease-in duration-75',
55
+ leaveToClass: 'opacity-0 scale-95'
56
+ }"
57
+ >
58
+ <div
59
+ slot =" trigger"
60
+ slot-scope =" {
61
+ mousedownHandler,
62
+ focusHandler,
63
+ blurHandler,
64
+ keydownHandler
65
+ }"
66
+ class =" flex"
67
+ >
68
+ <t-button
69
+ variant =" outline-secondary"
70
+ @mousedown =" mousedownHandler"
71
+ @focus =" focusHandler"
72
+ @blur =" blurHandler"
73
+ @keydown =" keydownHandler"
74
+ class =" text-white"
75
+ >
76
+ <TranslateIcon class =" w-4" />
77
+ </t-button >
78
+ </div >
79
+
80
+ <div class =" py-1 rounded-md shadow-xs" >
81
+ <nuxt-link
82
+ v-for =" locale in availableLocales"
83
+ :key =" locale.code"
84
+ :to =" switchLocalePath(locale.code)"
85
+ class =" block px-4 py-2 text-sm leading-5 text-gray-700 transition duration-150 ease-in-out hover:bg-gray-100 focus:outline-none focus:bg-gray-100"
86
+ >{{ locale.name }}</nuxt-link
87
+ >
88
+ </div >
89
+ </t-dropdown >
90
+ </div >
28
91
</div >
29
92
</div >
30
93
</header >
@@ -38,19 +101,15 @@ export default {
38
101
TranslateIcon
39
102
},
40
103
data (context ) {
41
- console .log (context .$store .state .menu .items );
42
- console .log (context .$store .state .menu .logo );
104
+ return {
105
+ menu: context .$store .state .menu .items ,
106
+ logo: context .$store .state .menu .logo
107
+ };
43
108
},
44
- setup () {
45
- const menu = [
46
- // { link: 'projects', text: 'menu.projects' },
47
- { link: ' collaborate' , text: ' menu.collaborate' },
48
- { link: ' team' , text: ' menu.team' },
49
- // { link: 'articles', text: 'menu.articles' },
50
- { link: ' contact' , text: ' menu.contact' }
51
- ];
52
-
53
- return { menu };
109
+ computed: {
110
+ availableLocales () {
111
+ return this .$i18n .locales .filter ((i ) => i .code !== this .$i18n .locale );
112
+ }
54
113
}
55
114
};
56
115
</script >
0 commit comments