import Typography, {
  TypographyProps,
} from "@/components/ui/Typography/Typography";
import { cn } from "@/lib/utils";

interface PolicyProps extends Omit<React.ComponentProps<"div">, "children"> {
  text?: TypographyProps<"p">;
  children?: React.ReactNode; // Support custom content with links
}

export default function Policy({ text, children, ...props }: PolicyProps) {
  return (
    <div {...props} className={cn("w-full", props.className)}>
      {children ? (
        // Custom content (e.g., with links)
        <Typography
          as="p"
          font="inter"
          size="xs"
          className="text-[#6B7280]"
        >
          {children}
        </Typography>
      ) : text ? (
        // Legacy text prop support
        <Typography
          as="p"
          font="inter"
          size="xs"
          {...text}
          className={cn("text-[#6B7280]", text.className)}
        />
      ) : null}
    </div>
  );
}
