<template>
  <div class="navigation-bar">
    <div class="nav-body">
      <router-link to="/" class="nav-logo">
        <img src="../assets/logo.png" alt="logo"/>
      </router-link>
      <div class="nav-search">
        <div class="nav-search-div">
          <input class="search-input" type="text" placeholder="搜索商品名称"/>
        </div>
        <!--          点击-->
        <button class="search-btn">
          <img src="../assets/nav_search-logo.svg" alt="搜索">
        </button>
      </div>
      <div class="nav-user">
        <div class="nav-user-icon" @click="showLogin = true">
          <div class="nav-user-icon-bg">
            <img src="../assets/nav_user_icon.svg" alt="登录">
          </div>
          <span>登录</span>
        </div>
        <div class="nav-user-menu">
          <div class="nav-user-icon-bg">
            <img src="../assets/nav_user_menu.svg" alt="菜单">
          </div>
        </div>
      </div>
    </div>
    <Login :show-login="showLogin" :func="func"/>
  </div>
</template>
<script setup lang="ts">
import {ref} from "vue";
import Login from "../components/Login.vue";

let showLogin = ref(false)

let func = function () {
  showLogin.value = !showLogin.value
  return showLogin.value
}

</script>
<style scoped lang="scss">

.navigation-bar {
  display: flex;
  place-items: center;
  height: 80px;

  background: #000000;

  .nav-body {
    height: 100%;
    width: 1170px;
    margin: auto auto;
    display: grid;
    grid-template-columns: 135px 1fr 150px;

    .nav-logo {
      grid-area: 1 / 1 / 2 / 2;
      margin: auto auto;
    }

    .nav-search {
      width: 450px;
      height: 40px;
      margin: auto auto;
      display: flex;
      border: none;

      .nav-search-div {

        .search-input {
          width: 370px;
          height: 40px;
          //padding-left: 15px;
          padding: 0 0 0 15px;
          font-size: 14px;
          border: none;
          outline: none;
          border-radius: 5px 0 0 5px;
        }
      }

      .search-btn {
        width: 70px;
        height: 40px;
        outline: none;
        margin: 0;
        border: none;
        background: #1475fa;
        border-radius: 0 5px 5px 0;

        &:hover {
          border: none;
          cursor: pointer;
        }

        &:active {
          border: none;
          background: #1470da;
          cursor: pointer;
        }

      }
    }

    .nav-user {
      display: grid;
      grid-template-columns: 70px 48px;
      margin: auto auto;
      width: 150px;
      height: 70px;
      color: white;

      .nav-user-icon {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 72px;
        cursor: pointer;
      }

      .nav-user-menu {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 48px;
        margin-left: 30px;

      }

      .nav-user-icon-bg {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        background: #1d1d1d;
        margin-right: 5px;
        display: flex;
        justify-content: center;
        align-items: center;

        img {
          cursor: pointer;
          margin: 0;
        }
      }
    }
  }
}


</style>