Skip to content
Snippets Groups Projects
Verified Commit d9021c6c authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: decimal places support

parent 0a48bcb2
No related branches found
No related tags found
1 merge request!9Version 0.4.0 🍾
Pipeline #1428 passed
...@@ -553,6 +553,7 @@ export const App: FC<AppProps> = ({ emulator, backgrounds = ["264653"] }) => { ...@@ -553,6 +553,7 @@ export const App: FC<AppProps> = ({ emulator, backgrounds = ["264653"] }) => {
delta={0.1} delta={0.1}
min={0} min={0}
suffix={"MHz"} suffix={"MHz"}
decimalPlaces={2}
/> />
} }
/> />
......
...@@ -10,6 +10,7 @@ type ButtonIncrementProps = { ...@@ -10,6 +10,7 @@ type ButtonIncrementProps = {
max?: number; max?: number;
prefix?: string; prefix?: string;
suffix?: string; suffix?: string;
decimalPlaces?: number;
size?: string; size?: string;
style?: string[]; style?: string[];
onClick?: () => void; onClick?: () => void;
...@@ -24,6 +25,7 @@ export const ButtonIncrement: FC<ButtonIncrementProps> = ({ ...@@ -24,6 +25,7 @@ export const ButtonIncrement: FC<ButtonIncrementProps> = ({
max, max,
prefix, prefix,
suffix, suffix,
decimalPlaces,
size = "medium", size = "medium",
style = ["simple", "border"], style = ["simple", "border"],
onClick, onClick,
...@@ -59,7 +61,9 @@ export const ButtonIncrement: FC<ButtonIncrementProps> = ({ ...@@ -59,7 +61,9 @@ export const ButtonIncrement: FC<ButtonIncrementProps> = ({
onClick={_onMinusClick} onClick={_onMinusClick}
/> />
{prefix && <span className="prefix">{prefix}</span>} {prefix && <span className="prefix">{prefix}</span>}
<span className="value">{valueState}</span> <span className="value">
{decimalPlaces ? valueState.toFixed(decimalPlaces) : valueState}
</span>
{suffix && <span className="suffix">{suffix}</span>} {suffix && <span className="suffix">{suffix}</span>}
<Button <Button
text={"+"} text={"+"}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment