import { View, Text } from '@tarojs/components'
import { TEntityComponent } from '@/types';
interface Props {
  children?: React.ReactChild |  React.ReactChild[];
  center?: boolean;
  id?: number
  title?: string
  editMode?: boolean
  data?: TEntityComponent
  onClick?: (e:any) => void;
}



const Index: React.FC<Props> = ({children, center=false, editMode, onClick}:Props) => {
  const handleClick = (e:any)=> {
    if(editMode){
      onClick && onClick(e)  
    }
  }

  return (
    <View className={`px-16 text-14 leading-28 ${center ? 'text-center': ''}`} onClick={handleClick}>
      <Text className='whitespace-normal break-words'>{children}</Text>
    </View>
  )
}

export default Index
