MainHeader.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <nav class="nav is-info">
  3. <div class="nav-left">
  4. <router-link class="nav-item is-brand" to="/">
  5. <img
  6. :src="`${this.frontendDomain}/assets/wordmark.png`"
  7. alt="Musare"
  8. />
  9. </router-link>
  10. </div>
  11. <span
  12. class="nav-toggle"
  13. :class="{ 'is-active': isMobile }"
  14. @click="isMobile = !isMobile"
  15. >
  16. <span />
  17. <span />
  18. <span />
  19. </span>
  20. <div class="nav-right nav-menu" :class="{ 'is-active': isMobile }">
  21. <router-link
  22. v-if="$parent.$parent.role === 'admin'"
  23. class="nav-item is-tab admin"
  24. to="/admin"
  25. >
  26. <strong>Admin</strong>
  27. </router-link>
  28. <router-link class="nav-item is-tab" to="/team">
  29. Team
  30. </router-link>
  31. <router-link class="nav-item is-tab" to="/about">
  32. About
  33. </router-link>
  34. <router-link class="nav-item is-tab" to="/news">
  35. News
  36. </router-link>
  37. <span v-if="$parent.$parent.loggedIn" class="grouped">
  38. <router-link
  39. class="nav-item is-tab"
  40. :to="{
  41. name: 'profile',
  42. params: { username: $parent.$parent.username }
  43. }"
  44. >
  45. Profile
  46. </router-link>
  47. <router-link class="nav-item is-tab" to="/settings"
  48. >Settings</router-link
  49. >
  50. <a
  51. class="nav-item is-tab"
  52. href="#"
  53. @click="$parent.$parent.logout()"
  54. >Logout</a
  55. >
  56. </span>
  57. <span v-else class="grouped">
  58. <a
  59. class="nav-item"
  60. href="#"
  61. @click="
  62. toggleModal({
  63. sector: 'header',
  64. modal: 'login'
  65. })
  66. "
  67. >Login</a
  68. >
  69. <a
  70. class="nav-item"
  71. href="#"
  72. @click="
  73. toggleModal({
  74. sector: 'header',
  75. modal: 'register'
  76. })
  77. "
  78. >Register</a
  79. >
  80. </span>
  81. </div>
  82. </nav>
  83. </template>
  84. <script>
  85. import { mapState, mapActions } from "vuex";
  86. export default {
  87. data() {
  88. return {
  89. isMobile: false,
  90. frontendDomain: ""
  91. };
  92. },
  93. mounted: function() {
  94. lofig.get("frontendDomain", res => {
  95. this.frontendDomain = res;
  96. });
  97. },
  98. computed: mapState("modals", {
  99. modals: state => state.modals.header
  100. }),
  101. methods: {
  102. ...mapActions("modals", ["toggleModal"])
  103. }
  104. };
  105. </script>
  106. <style lang="scss" scoped>
  107. .nav {
  108. background-color: #03a9f4;
  109. height: 64px;
  110. .nav-menu.is-active {
  111. .nav-item {
  112. color: #333;
  113. &:hover {
  114. color: #333;
  115. }
  116. }
  117. }
  118. .nav-toggle {
  119. height: 64px;
  120. &.is-active span {
  121. background-color: #333;
  122. }
  123. }
  124. .is-brand {
  125. font-size: 2.1rem !important;
  126. line-height: 64px !important;
  127. padding: 0 20px;
  128. color: #ffffff;
  129. font-family: Pacifico, cursive;
  130. filter: brightness(0) invert(1);
  131. img {
  132. max-height: 38px;
  133. }
  134. }
  135. .nav-item {
  136. font-size: 17px;
  137. color: #ffffff;
  138. &:hover {
  139. color: #ffffff;
  140. }
  141. }
  142. .admin strong {
  143. color: #9d42b1;
  144. }
  145. }
  146. .grouped {
  147. margin: 0;
  148. display: flex;
  149. text-decoration: none;
  150. }
  151. .nightMode {
  152. .nav {
  153. background-color: #012332;
  154. height: 64px;
  155. .nav-menu.is-active {
  156. .nav-item {
  157. color: #333;
  158. &:hover {
  159. color: #333;
  160. }
  161. }
  162. }
  163. .nav-toggle {
  164. height: 64px;
  165. &.is-active span {
  166. background-color: #333;
  167. }
  168. }
  169. .is-brand {
  170. font-size: 2.1rem !important;
  171. line-height: 64px !important;
  172. padding: 0 20px;
  173. }
  174. .nav-item {
  175. font-size: 15px;
  176. color: hsl(0, 0%, 100%);
  177. &:hover {
  178. color: hsl(0, 0%, 100%);
  179. }
  180. }
  181. .admin strong {
  182. color: #03a9f4;
  183. }
  184. }
  185. }
  186. </style>