Skip to content

Commit a9ed5b5

Browse files
author
Alberto Iannaccone
committed
add unit of measure to settings step input
1 parent 4958ace commit a9ed5b5

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

arduino-ide-extension/src/browser/dialogs/settings/settings-component.tsx

+11-9
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,17 @@ export class SettingsComponent extends React.Component<
188188
/>
189189
{nls.localize('arduino/preferences/automatic', 'Automatic')}
190190
</label>
191-
<SettingsStepInput
192-
value={scalePercentage}
193-
setSettingsStateValue={this.setInterfaceScale}
194-
step={scaleStep}
195-
maxValue={maxScale}
196-
minValue={minScale}
197-
classNames={{ input: 'theia-input small with-margin' }}
198-
/>
199-
%
191+
<div>
192+
<SettingsStepInput
193+
value={scalePercentage}
194+
setSettingsStateValue={this.setInterfaceScale}
195+
step={scaleStep}
196+
maxValue={maxScale}
197+
minValue={minScale}
198+
unitOfMeasure="%"
199+
classNames={{ input: 'theia-input small with-margin' }}
200+
/>
201+
</div>
200202
</div>
201203
<div className="flex-line">
202204
<select

arduino-ide-extension/src/browser/dialogs/settings/settings-step-input.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,22 @@ interface SettingsStepInputProps {
77
step: number;
88
maxValue: number;
99
minValue: number;
10+
unitOfMeasure?: string;
1011
classNames?: { [key: string]: string };
1112
}
1213

1314
const SettingsStepInput: React.FC<SettingsStepInputProps> = (
1415
props: SettingsStepInputProps
1516
) => {
16-
const { value, setSettingsStateValue, step, maxValue, minValue, classNames } =
17-
props;
17+
const {
18+
value,
19+
setSettingsStateValue,
20+
step,
21+
maxValue,
22+
minValue,
23+
unitOfMeasure,
24+
classNames,
25+
} = props;
1826

1927
const clamp = (value: number, min: number, max: number): number => {
2028
return Math.min(Math.max(value, min), max);
@@ -86,6 +94,7 @@ const SettingsStepInput: React.FC<SettingsStepInputProps> = (
8694
&#9662;
8795
</button>
8896
</div>
97+
{unitOfMeasure && `${unitOfMeasure}`}
8998
</div>
9099
);
91100
};

arduino-ide-extension/src/browser/style/settings-step-input.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
display: none;
1313
flex-direction: column;
1414
position: absolute;
15-
right: 0px;
15+
right: 14px;
1616
top: 50%;
1717
transform: translate(0px, -50%);
1818
height: calc(100% - 4px);

0 commit comments

Comments
 (0)