<template>
  <view class="layout">
    <view :style="{ background: color }" 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>
      </view>
    </view>
  </view>
</template>

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

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

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

    .statusBar {
    }

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

      .title {
        font-size: 36rpx;
        font-weight: 400;
        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>
