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:
@@ -7,7 +7,8 @@ import type { PatientRecord } from '../types';
|
||||
import type { SessionCardData } from '../components/SessionServiceCard';
|
||||
import CreateStep from '../components/session/CreateStep';
|
||||
import PaymentStep from '../components/session/PaymentStep';
|
||||
import { ArrowLeftPH, ArrowLeftD, CloseModalD } from '../components/icons/FilesServiceIcons';
|
||||
import { CloseModalD } from '../components/icons/FilesServiceIcons';
|
||||
import { Breadcrumb } from '../components/PatientCaseBanner';
|
||||
|
||||
/** ویرایش مراجعهی ثبتشده — دو تب: ویرایش سرویسها + مدیریت پرداختها. */
|
||||
export default function EditSessionPage() {
|
||||
@@ -41,18 +42,7 @@ export default function EditSessionPage() {
|
||||
|
||||
return (
|
||||
<div className="fade-in" style={{ width: '100%' }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-start', marginBottom: 30 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, color: 'var(--text-2)', fontSize: 12, padding: '0 16px' }}>
|
||||
<div onClick={() => nav(-1)} className="bg-[var(--surface)]" style={{ display: 'flex', alignItems: 'center', gap: 4, padding: '6px 8px', borderRadius: 12, cursor: 'pointer' }}>
|
||||
<ArrowLeftPH style={{ width: 18, height: 18, rotate: '180deg' }} />
|
||||
<span>بازگشت</span>
|
||||
</div>
|
||||
<ArrowLeftD />
|
||||
<span>پرونده</span>
|
||||
<ArrowLeftD />
|
||||
<span style={{ color: 'var(--text)' }}>{patientName}</span>
|
||||
</div>
|
||||
</div>
|
||||
<Breadcrumb name={patientName} backTo={`/admin/patients/${recordUuid}`} />
|
||||
|
||||
<div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
|
||||
<div className="bg-[var(--surface)]" style={{ width: 748, maxWidth: '100%', padding: 24 }}>
|
||||
|
||||
Reference in New Issue
Block a user