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

@ -22,11 +22,16 @@ import { updateCursors } from '../../lang/util'
const getModalInfo = create(SetAngleLengthModal as any)
export const SetAbsDistance = ({
buttonType,
}: {
buttonType: 'xAbs' | 'yAbs' | 'snapToYAxis' | 'snapToXAxis'
}) => {
type ButtonType = 'xAbs' | 'yAbs' | 'snapToYAxis' | 'snapToXAxis'
const buttonLabels: Record<ButtonType, string> = {
xAbs: 'Set distance from X Axis',
yAbs: 'Set distance from Y Axis',
snapToYAxis: 'Snap To Y Axis',
snapToXAxis: 'Snap To X Axis',
}
export const SetAbsDistance = ({ buttonType }: { buttonType: ButtonType }) => {
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
useStore((s) => ({
guiMode: s.guiMode,
@ -132,8 +137,9 @@ export const SetAbsDistance = ({
}
}}
disabled={!enableAngLen}
title={buttonLabels[buttonType]}
>
{buttonType}
{buttonLabels[buttonType]}
</button>
)
}