Skip to content

Commit

Permalink
refactor(editor) Introduced a constant for the increment/decrement am…
Browse files Browse the repository at this point in the history
…ount.
  • Loading branch information
seanparsons committed Oct 25, 2024
1 parent 0fb86de commit e567e80
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion editor/src/uuiui/inputs/grid-expression-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ interface GridExpressionInputProps {

const DropdownWidth = 25

const ArrowKeyFractionalIncrement = 0.1

export const GridExpressionInput = React.memo(
({
testId,
Expand Down Expand Up @@ -111,7 +113,10 @@ export const GridExpressionInput = React.memo(
gridNumberValueOptic.compose(fromField('value'))
if (exists(valueUnitOptic, value)) {
function updateFractional(fractionalValue: number): number {
return fractionalValue + (e.key === 'ArrowUp' ? 0.1 : -0.1)
return (
fractionalValue +
(e.key === 'ArrowUp' ? ArrowKeyFractionalIncrement : -ArrowKeyFractionalIncrement)
)
}
const updatedDimension = modify(gridNumberNumberOptic, updateFractional, value)
onUpdateDimension(updatedDimension)
Expand Down

0 comments on commit e567e80

Please sign in to comment.