Franknoirot/pretty buttons (#550)

This commit is contained in:
Frank Noirot
2023-09-16 01:23:11 -04:00
committed by GitHub
parent 31eca3728e
commit f592d8db84
16 changed files with 377 additions and 52 deletions

View File

@ -23,10 +23,17 @@ import { updateCursors } from '../../lang/util'
const getModalInfo = create(SetAngleLengthModal as any)
type ButtonType = 'setAngle' | 'setLength'
const buttonLabels: Record<ButtonType, string> = {
setAngle: 'Set Angle',
setLength: 'Set Length',
}
export const SetAngleLength = ({
angleOrLength,
}: {
angleOrLength: 'setAngle' | 'setLength'
angleOrLength: ButtonType
}) => {
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
@ -144,8 +151,9 @@ export const SetAngleLength = ({
}
}}
disabled={!enableAngLen}
title={buttonLabels[angleOrLength]}
>
{angleOrLength}
{buttonLabels[angleOrLength]}
</button>
)
}