feat: implement BackButton component for consistent navigation
- Added BackButton component to standardize back navigation across pages. - Integrated BackButton into various pages, replacing custom back buttons for consistency. - Updated PageHeader to accept backTo prop for displaying BackButton when navigating from subpages. - Created useGoBack hook to handle navigation logic, determining whether to go back in history or redirect to a fallback page. - Added tests for BackButton and its integration with PageHeader to ensure expected behavior.
This commit is contained in:
@@ -578,13 +578,11 @@ export default function ClinicDetailPage() {
|
||||
|
||||
{/* ── Header ── */}
|
||||
<PageHeader
|
||||
backTo="/admin/clinics"
|
||||
title={clinicName}
|
||||
breadcrumbs={[{ label: 'کلینیکها', to: '/admin/clinics' }, { label: clinicName }]}
|
||||
action={
|
||||
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', justifyContent: 'flex-end' }}>
|
||||
<button className="btn ghost sm" onClick={() => navigate('/admin/clinics')}>
|
||||
<ArrowRightIcon style={{ width: 15, height: 15 }} /> بازگشت
|
||||
</button>
|
||||
{!isReadOnly && (
|
||||
<button className="btn soft sm" onClick={() => openEdit()}>
|
||||
<PencilIcon style={{ width: 15, height: 15 }} /> ویرایش
|
||||
|
||||
Reference in New Issue
Block a user