返回 oh-my-ppt
LayoutInspector.tsx
1 import { Move } from 'lucide-react'
2 import { InspectorSection } from './InspectorSection'
3 import type { ElementEditorProps, ElementEditDraft } from './types'
4 import { useT } from '@renderer/i18n'
5
6 const LAYOUT_FIELDS: Array<{ key: keyof ElementEditDraft; label: string }> = [
7 { key: 'layoutX', label: 'X' },
8 { key: 'layoutY', label: 'Y' },
9 { key: 'layoutWidth', label: 'W' },
10 { key: 'layoutHeight', label: 'H' }
11 ]
12
13 export function LayoutInspector({ draft }: ElementEditorProps): React.JSX.Element {
14 const t = useT()
15 return (
16 <InspectorSection
17 title={t('sessionDetail.adjustLayout')}
18 icon={<Move className="h-3.5 w-3.5 text-[#7a875f]" />}
19 >
20 <div className="grid grid-cols-4 gap-2">
21 {LAYOUT_FIELDS.map(({ key, label }) => (
22 <div key={key} className="space-y-1 text-center">
23 <span className="text-[11px] font-medium text-[#7a875f]">{label}</span>
24 <div className="flex h-8 items-center justify-center rounded-full border border-[#d7cbb7]/40 bg-[#f5efe4]/40 px-1.5 text-[11px] text-[#a0977e]/70">
25 {draft[key]}
26 </div>
27 </div>
28 ))}
29 </div>
30 </InspectorSection>
31 )
32 }
33
33 lines Plain Text