import type { CSSProperties, ReactNode } from "react";

interface FormFieldProps {
  label: ReactNode;
  children: ReactNode;
  error?: string;
  required?: boolean;
  style?: React.CSSProperties;
}

export default function FormField({
  label,
  children,
  error,
  required,
  style,
}: FormFieldProps) {
  return (
    <div className="admin-form-group" style={style}>
      <label className="admin-form-label">
        {label}
        {required && <span className="admin-form-required"> *</span>}
      </label>
      {children}
      {error && <span className="admin-form-error">{error}</span>}
    </div>
  );
}
