Nav.vue 5.9 KB

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