import React, { ReactNode } from 'react'
import { View } from '@tarojs/components'
import { cn } from '@/utils/cn'

export interface PageContainerProps {
  children: ReactNode
  className?: string
  padding?: boolean
  background?: string
  safeArea?: boolean
}

export const PageContainer: React.FC<PageContainerProps> = ({
  children,
  className,
  padding = true,
  background = 'bg-gray-50',
  safeArea = true,
}) => {
  return (
    <View className={cn(
      'min-h-screen w-full',
      background,
      safeArea && 'pb-safe',
      className
    )}>
      <View className={cn(
        padding && 'px-4 py-4',
        'max-w-screen-md mx-auto'
      )}>
        {children}
      </View>
    </View>
  )
}

export default PageContainer