import { useNavigate } from 'react-router-dom';
import './Page.css';

function Page({ title, children, showBackButton = false }) {
    const navigate = useNavigate();

    return (
        <div className="page">
            <div className="page-header">
                {showBackButton && (
                    <button onClick={() => navigate(-1)} className="back-button">
                        ← Back
                    </button>
                )}
                <h1>{title}</h1>
            </div>
            <div className="page-content">
                {children}
            </div>
        </div>
    );
}

export default Page;
