From 7c82459e1fe2419f03375bb2fcd0b3c870cf16e6 Mon Sep 17 00:00:00 2001 From: ochafik Date: Mon, 23 Dec 2024 23:59:56 +0000 Subject: [PATCH] Shorter label for ExportButton, longer in dropdown --- src/components/ExportButton.tsx | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/components/ExportButton.tsx b/src/components/ExportButton.tsx index 9c7ce1e..fe4b8db 100644 --- a/src/components/ExportButton.tsx +++ b/src/components/ExportButton.tsx @@ -4,42 +4,49 @@ import { ModelContext } from './contexts'; import { SplitButton } from 'primereact/splitbutton'; import { MenuItem } from 'primereact/menuitem'; +type ExtendedMenuItem = MenuItem & { buttonLabel: string }; + export default function ExportButton({className, style}: {className?: string, style?: React.CSSProperties}) { const model = useContext(ModelContext); if (!model) throw new Error('No model'); const state = model.state; - const dropdownModel: MenuItem[] = + const dropdownModel: ExtendedMenuItem[] = state.is2D ? [ { data: 'svg', - label: 'SVG', + buttonLabel: 'SVG', + label: 'SVG (Simple Vector Graphics)', icon: 'pi pi-download', command: () => model!.setFormats('svg', undefined), }, { data: 'dxf', - label: 'DXF', + buttonLabel: 'DXF', + label: 'DXF (Drawing Exchange Format)', icon: 'pi pi-download', command: () => model!.setFormats('dxf', undefined), }, ] : [ { data: 'glb', - label: 'GLB (glTF)', - icon: 'pi pi-download', + buttonLabel: 'GLB', + label: 'GLB (binary glTF)', + icon: 'pi pi-file', command: () => model!.setFormats(undefined, 'glb'), }, { data: 'stl', - label: 'STL', - icon: 'pi pi-download', + buttonLabel: 'STL', + label: 'STL (binary)', + icon: 'pi pi-file', command: () => model!.setFormats(undefined, 'stl'), }, { data: 'off', - label: 'OFF', - icon: 'pi pi-download', + buttonLabel: 'OFF', + label: 'OFF (Object File Format)', + icon: 'pi pi-file', command: () => model!.setFormats(undefined, 'off'), }, ]; @@ -50,7 +57,7 @@ export default function ExportButton({className, style}: {className?: string, st return (