Nav.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <script setup lang="ts">
  2. import {onMounted, ref} from 'vue';
  3. import {useSunStore,useAddressStore} from "@/stores/sun";
  4. import router from "@/router";
  5. const sunStore = useSunStore()
  6. const addressStore = useAddressStore()
  7. let pathname = ref('')
  8. const emit = defineEmits(["doSth"]);
  9. const doSth = () => {
  10. emit('doSth')
  11. }
  12. onMounted(() => {
  13. pathname.value = window.location.pathname
  14. console.log(window.location.pathname);
  15. })
  16. const sunAndMoon = () => {
  17. if (sunStore.sun) {
  18. document.documentElement.style.setProperty('--color-background', '#000000')
  19. document.documentElement.style.setProperty('--color-text', '#f2f2f2')
  20. document.documentElement.style.setProperty('--vt-c-border', '#555555')
  21. document.documentElement.style.setProperty('--vt-c-pure', '#000000')
  22. } else {
  23. document.documentElement.style.setProperty('--color-background', '#fcfffa')
  24. document.documentElement.style.setProperty('--color-text', '#181818')
  25. document.documentElement.style.setProperty('--vt-c-border', '#f1f1f1')
  26. document.documentElement.style.setProperty('--vt-c-pure', '#ffffff')
  27. }
  28. sunStore.change()
  29. }
  30. const connectWallet = () => {
  31. doSth()
  32. }
  33. const toHome = () => {
  34. router.push('/')
  35. }
  36. const toAirdrop = () => {
  37. router.push('/zksync')
  38. }
  39. let lod = false
  40. const toNFT = () => {
  41. if (lod){
  42. return
  43. }
  44. lod = true
  45. router.push('/')
  46. setTimeout(function (){
  47. let NFT = document.querySelector('#NFT')
  48. if(NFT){
  49. NFT.scrollIntoView({
  50. behavior: "smooth"
  51. })
  52. lod = false
  53. }
  54. },200)
  55. }
  56. </script>
  57. <template>
  58. <div class="topBar">
  59. <div class="left">
  60. <div class="img">
  61. <img v-show="!sunStore.sun" src="../assets/bitflower-white.svg" alt="bitflower">
  62. <img v-show="sunStore.sun" src="../assets/bitflower.svg" alt="logo">
  63. </div>
  64. <div class="nav" @click="toHome">
  65. Home
  66. </div>
  67. <div class="nav" @click="toNFT">
  68. NFT
  69. </div>
  70. <div class="nav" @click="toAirdrop">
  71. Airdrop
  72. </div>
  73. </div>
  74. <div class="right">
  75. <img v-show="!sunStore.sun" @click="sunAndMoon" src="../assets/sun-fill.svg" alt="sun-fill">
  76. <img v-show="sunStore.sun" @click="sunAndMoon" src="../assets/moon-clear-fill.svg" alt="moon-clear-fill">
  77. <div v-show="pathname !== '/'">
  78. <div class="button" v-show="!addressStore.address" @click="connectWallet">
  79. <img src="../assets/git-commit-line.svg" alt="commit">
  80. Connect Wallet
  81. </div>
  82. <div class="connect" v-if="addressStore.address">
  83. <img src="../assets/git-commit-line-black.svg" alt="commit">
  84. {{ addressStore.address.slice(0, 8) }}...{{ addressStore.address.slice(-4) }}
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <style scoped lang="scss">
  91. .topBar {
  92. display: flex;
  93. align-items: center;
  94. justify-content: space-between;
  95. padding: 0 60px 25px;
  96. margin: 0 -60px;
  97. border-bottom: 1px solid var(--vt-c-border);
  98. .left {
  99. display: flex;
  100. align-items: center;
  101. .img{
  102. padding-right: 60px;
  103. }
  104. .nav {
  105. font-family: HONOR Sans CN;
  106. font-size: 21px;
  107. font-style: normal;
  108. font-weight: 700;
  109. line-height: normal;
  110. padding: 0 60px;
  111. height: 100px;
  112. display: flex;
  113. align-items: center;
  114. margin-bottom: -25px;
  115. margin-top: -30px;
  116. border-right: 1px solid var(--vt-c-border);
  117. border-left: 1px solid var(--vt-c-border);
  118. position: relative;
  119. cursor: pointer;
  120. .line {
  121. position: absolute;
  122. width: 100%;
  123. height: 10px;
  124. background: var(--color-text);
  125. left: 0;
  126. bottom: 0;
  127. }
  128. }
  129. .nav:hover{
  130. background: rgba(255, 255, 255, 0.30);
  131. backdrop-filter: blur(12px);
  132. }
  133. .navOne {
  134. font-family: HONOR Sans CN;
  135. font-size: 21px;
  136. font-style: normal;
  137. font-weight: 700;
  138. line-height: normal;
  139. padding: 0 60px;
  140. height: 100px;
  141. display: flex;
  142. align-items: center;
  143. margin-bottom: -25px;
  144. margin-top: -30px;
  145. border-right: 1px solid var(--vt-c-border);
  146. margin-left: 57px;
  147. border-left: 1px solid var(--vt-c-border);
  148. position: relative;
  149. cursor: pointer;
  150. .line {
  151. position: absolute;
  152. width: 100%;
  153. height: 10px;
  154. background: var(--color-text);
  155. left: 0;
  156. bottom: 0;
  157. }
  158. }
  159. }
  160. .mid {
  161. font-weight: 400;
  162. font-size: 15px;
  163. line-height: 21px;
  164. font-family: 'Chillax';
  165. text-transform: uppercase;
  166. }
  167. .right {
  168. display: flex;
  169. align-items: center;
  170. gap: 40px;
  171. cursor: pointer;
  172. .button {
  173. width: fit-content;
  174. height: 44px;
  175. display: flex;
  176. align-items: center;
  177. gap: 6px;
  178. background: #010101;
  179. padding: 0 24px;
  180. font-weight: 500;
  181. font-size: 15px;
  182. line-height: 20px;
  183. color: #FFFFFF;
  184. cursor: pointer;
  185. }
  186. .connect {
  187. width: fit-content;
  188. height: 44px;
  189. display: flex;
  190. align-items: center;
  191. gap: 6px;
  192. background: #FFFFFF;
  193. border: 1px solid #010101;
  194. border-radius: 30px;
  195. padding: 0 24px;
  196. font-weight: 500;
  197. font-size: 15px;
  198. line-height: 20px;
  199. color: #010101;
  200. }
  201. }
  202. }
  203. </style>