<template>
  <view class="layout">
    <view class="navbar">
      <view :style="{ height: getStatusBarHeight() + 'px' }" class="statusBar"></view>
      <view
        :style="{ height: getTitleBarHeight() + 'px', marginLeft: getLeftIconLeft() + 'px' }"
        class="titleBar"
      >
        <view class="title">{{ title }}</view>
        <navigator class="search" url="/pages/search/search">
          <uni-icons class="icon" color="#888" size="18" type="search"></uni-icons>
          <text class="text">></text>
        </navigator>
      </view>
    </view>

    <view :style="{ height: getNavBarHeight() + 'px' }" class="fill"></view>
  </view>
</template>

<script setup>
import { ref } from 'vue'
import {
  getStatusBarHeight,
  getTitleBarHeight,
  getNavBarHeight,
  getLeftIconLeft,
} from '@/utils/system.js'

defineProps({
  title: {
    type: String,
    default: '壁纸',
  },
})
</script>

<style lang="scss" scoped>
.layout {
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    background: #ffddca;

    .statusBar {
    }

    .titleBar {
      display: flex;
      align-items: center;
      padding: 0 30rpx;

      .title {
        font-size: 32rpx;
        font-weight: 500;
        color: #3d3d3d;
      }

      .search {
        width: 220rpx;
        height: 50rpx;
        margin-left: 10rpx;
        color: #3d3d3d;
        font-size: 28rpx;
        display: flex;
        align-items: center;

        .icon {
          margin-left: 5rpx;
        }

        .text {
          padding-left: 10rpx;
        }
      }
    }
  }

  .fill {
  }
}
</style>
