import "./index.less";
import Taro, { getMenuButtonBoundingClientRect } from "@tarojs/taro";
import back from "@/assets/images/kitchenWaste/back.svg";
import { View, Image } from "@tarojs/components";

interface Props {
  title: string;
}

/**
 * @description 导航自定义头部
 */
export default (props: Props) => {
  const { title } = props;
  const cachet = getMenuButtonBoundingClientRect();

  return (
    <View className="nav-bar" style={{ paddingTop: cachet.top + 6 }}>
      <View
        onTap={() => {
          Taro.navigateBack();
        }}
        className="back"
      >
        <Image src={back} />
      </View>
      {title}
    </View>
  );
};
