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:
@@ -14,6 +14,7 @@ import { WalletChargeLink } from '../components/AppointmentActions';
|
||||
import { useDoctorBookingServices } from '../hooks/useDoctorBookingServices';
|
||||
import ServiceSlotPicker from '../components/appointments/ServiceSlotPicker';
|
||||
import { tehranWallClockToUnix, rialToToman, tomanToRial } from '../lib/utils';
|
||||
import BackButton from '../components/ui/BackButton';
|
||||
import { digitsOnly, todayIso } from '../lib/utils';
|
||||
|
||||
/**
|
||||
@@ -166,9 +167,7 @@ export default function AppointmentCreatePage() {
|
||||
<div style={{ padding: '20px 24px', maxWidth: 1080, margin: '0 auto' }}>
|
||||
{/* بردکرامب */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 18 }}>
|
||||
<button onClick={() => navigate(-1)} className="btn sm" style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||
<ChevronRightIcon style={{ width: 15, height: 15 }} /> بازگشت
|
||||
</button>
|
||||
<BackButton fallback="/admin/appointments" />
|
||||
<span style={{ fontSize: 13, color: 'var(--text-3)' }}>نوبت ها</span>
|
||||
<span style={{ color: 'var(--text-3)' }}>›</span>
|
||||
<span style={{ fontSize: 15, fontWeight: 700, color: 'var(--text)' }}>ثبت نوبت جدید</span>
|
||||
|
||||
Reference in New Issue
Block a user