feat: replace checkboxes with Switch component for better UI consistency
- Updated DoctorDetailPage, MySecretariesPage, RecordNumberSettingsPage, RepresentationsPage, ResourcePoolsPage, ResourceTypesPage, SecretariesPage, SecretaryDetailPage, SettingsPage, SkillsPage, SmsWalletPage, and TagsSettingsPage to use the new Switch component instead of native checkboxes. - Enhanced accessibility by ensuring the Switch component uses appropriate roles and labels. - Added tests for the new Switch component to ensure functionality and accessibility compliance. - Updated styles to accommodate the new Switch component design.
This commit is contained in:
@@ -22,6 +22,7 @@ import PageHeader from '../components/ui/PageHeader';
|
||||
import FeatureGate from '../components/ui/FeatureGate';
|
||||
import { usePermissions } from '../hooks/usePermissions';
|
||||
import { numericField } from '../lib/forms';
|
||||
import Switch from '../components/ui/Switch';
|
||||
|
||||
const chargeSchema = z.object({
|
||||
amount_rials: z.coerce.number().min(1000, 'حداقل مبلغ ۱٬۰۰۰ تومان است'),
|
||||
@@ -262,14 +263,13 @@ function SmsWalletPageInner() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<label className="switch" style={{ marginTop: 4, flexShrink: 0 }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
<span style={{ marginTop: 4, flexShrink: 0 }}>
|
||||
<Switch
|
||||
checked={currentSettings.reminder_enabled}
|
||||
onChange={() => setLocalSettings({ ...currentSettings, reminder_enabled: !currentSettings.reminder_enabled })}
|
||||
onChange={(v) => setLocalSettings({ ...currentSettings, reminder_enabled: v })}
|
||||
ariaLabel="یادآوری نوبت"
|
||||
/>
|
||||
<span className="switch-track"><span className="switch-thumb" /></span>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* ردیف: پیامک بعد از ویزیت */}
|
||||
@@ -285,14 +285,13 @@ function SmsWalletPageInner() {
|
||||
<div style={{ color: 'var(--text-3)', fontSize: 12.5, marginTop: 3 }}>متن تشکر پس از پایان مراجعه برای بیمار ارسال میشود</div>
|
||||
</div>
|
||||
</div>
|
||||
<label className="switch" style={{ flexShrink: 0 }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
<span style={{ flexShrink: 0 }}>
|
||||
<Switch
|
||||
checked={currentSettings.post_visit_enabled}
|
||||
onChange={() => setLocalSettings({ ...currentSettings, post_visit_enabled: !currentSettings.post_visit_enabled })}
|
||||
onChange={(v) => setLocalSettings({ ...currentSettings, post_visit_enabled: v })}
|
||||
ariaLabel="پیام پس از مراجعه"
|
||||
/>
|
||||
<span className="switch-track"><span className="switch-thumb" /></span>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* محتوای بازشونده */}
|
||||
|
||||
Reference in New Issue
Block a user