polish(admin): 抽出后台控件包并统一各页布局与交互
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
28
frontend/components/admin/AdminSwitch.tsx
Normal file
28
frontend/components/admin/AdminSwitch.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
/** 后台唯一开关控件 */
|
||||
export default function AdminSwitch({
|
||||
checked,
|
||||
disabled,
|
||||
onChange,
|
||||
label,
|
||||
}: {
|
||||
checked: boolean;
|
||||
disabled?: boolean;
|
||||
onChange: () => void;
|
||||
label: string;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={checked}
|
||||
aria-label={label}
|
||||
disabled={disabled}
|
||||
onClick={onChange}
|
||||
className="admin-switch"
|
||||
>
|
||||
<span className="admin-switch-knob" aria-hidden />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user