返回 DeepSeek-Reasonix
FoldToggle.tsx
根目录 / desktop / frontend / src / components / harness-chat / FoldToggle.tsx
1 // Ported from DeepSeek Harness c291e7961a (MIT).
2 interface FoldToggleProps {
3 className: string | undefined
4 expanded: boolean
5 hidden: number
6 labels: {
7 collapseAria: string
8 expandAria: (hidden: number) => string
9 collapse: string
10 expand: (hidden: number) => string
11 }
12 onToggle: () => void
13 }
14
15 /**
16 * Render the shared head-tail fold control with caller-owned localized copy.
17 * @param props - Fold state, localized labels, and toggle callback.
18 * @returns The accessible expand or collapse button.
19 */
20 export function FoldToggle({
21 className, expanded, hidden, labels, onToggle,
22 }: FoldToggleProps) {
23 return (
24 <button
25 type="button"
26 className={className}
27 aria-expanded={expanded}
28 aria-label={expanded ? labels.collapseAria : labels.expandAria(hidden)}
29 onClick={onToggle}
30 >
31 {expanded ? labels.collapse : labels.expand(hidden)}
32 </button>
33 )
34 }
35
35 lines Plain Text