<template>
  <div class="row">
    <div class="back" :style="{ backgroundImage: `url(${theme.images.back})` }" v-if="path !== '/index'" @click="() => $router.push('/index')"></div>
    <div class="bar" @click="handleSearch">
      <div class="icon" :style="{ backgroundImage: `url(${theme.images.searchIcon})` }"></div>
      <div class="stick"></div>
      <div class="placeholder">精确查询品牌/公共设施</div>
    </div>
  </div>
</template>

<script setup>
import { useStore } from '@/store/root'
import { storeToRefs } from 'pinia'
const store = useStore()
const handleSearch = () => store.SET_SHOW_SEARCH(true)
const { theme, path } = storeToRefs(store)
</script>

<style lang="scss" scoped>
@media (max-aspect-ratio: 1/1) {
  .row {
    position: fixed;
    top: 260px;
    left: 68px;
    right: 68px;
    height: 100px;
    display: flex;
    z-index: 100;
  }
}
.row {
  .back {
    width: 130px;
    height: 100px;
    margin-right: 40px;
    background: center / cover no-repeat;
    box-shadow: 0px 15px 24px rgba(0, 0, 0, 0.05);
    border-radius: var(--searchBar-backBorderRadius);
  }
  .bar {
    flex: 1;
    height: 100px;
    background: var(--searchBar-background);
    border: var(--searchBar-border);
    box-shadow: 0px 15px 24px rgba(0, 0, 0, 0.05);
    border-radius: var(--searchBar-borderRadius);
    display: flex;
    padding-left: 40px;
    align-items: center;
    .icon {
      width: 56px;
      height: 56px;
      background: center / cover no-repeat;
    }
    .stick {
      width: 4px;
      height: 38px;
      background: var(--searchBar-stickBg);
      margin: 0 32px;
    }
    .placeholder {
      font-style: normal;
      font-weight: 700;
      font-size: 20px;
      line-height: 23px;
      color: var(--searchBar-placeholderColor);
    }
  }
}
@media (min-aspect-ratio: 1/1) {
  .row {
    .back {
      position: fixed;
      left: 68px;
      top: 161px;
      z-index: 100;
    }
    .bar {
      position: fixed;
      width: 698px;
      top: 38px;
      left: 0;
      right: 0;
      margin: auto;
      z-index: 100;
    }
  }
}
</style>
