import { Text, View } from "@tarojs/components";
interface Iprops {
  labelText?: string,
  required?: boolean
  labelRenderer?: JSX.Element
  children: JSX.Element
}

export default function Index({labelText, required, labelRenderer, children}:Iprops) {
  const renderLabel = ()=> {
    if(labelRenderer){
      return labelRenderer
    }
    return <View className="text-14 font-medium text-black leading-28">
        {labelText} {required && <Text className="text-red">*</Text>}
      </View>
  }
  return (
    <View className="flex flex-col gap-6  w-full">
      {renderLabel()}
      {children}
    </View>
  );
}
