/**
 * 用于 page 根目录的样式等设置
 */
import { View, Video, Image } from "@tarojs/components";
import React, { useState } from "react";
import pageStyle from "./index.module.less";
import { GlobalModal } from '@/components/GlobalModal/index';
import Custombg from './CustomBg'
interface Props {
  children?: React.ReactChild | React.ReactChild[];
  style?: React.CSSProperties;
  styleBg?: string|null;
  onClick?: (e:any)=> void
}

const Index: React.FC<Props> = ({ children, styleBg, style, onClick }) => {
  //  盖在背景上面的是视口高度的 渐变色
  const handleClick = (e:any)=> {
    onClick && onClick(e)
  }
  
  return (
    <View className={`relative font-normal text-14 leading-22 w-full`} onClick={handleClick}>
      {/* cover 背景图覆盖从上至下渐变 */}
      <View className={`global-linear-gradient-bg ${pageStyle.bgVerticalGradient}`}></View>
      {/* bg 背景图 */}
      <Custombg styleBg={styleBg}></Custombg>
      <View className="relative z-0 h-full w-full" style={style}>{children}</View>
      <GlobalModal></GlobalModal>
    </View>
  );
};

export default Index;
