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

feat: better button increment

With support for prefix and suffux
parent 91c793f4
No related branches found
No related tags found
1 merge request!8Support for react.js components
Pipeline #1145 passed
...@@ -21,7 +21,9 @@ export const App = () => { ...@@ -21,7 +21,9 @@ export const App = () => {
<Pair <Pair
key="button-tobias" key="button-tobias"
name={"Button Increment"} name={"Button Increment"}
valueNode={<ButtonIncrement value={200} delta={100} />} valueNode={
<ButtonIncrement value={200} delta={100} suffix={"Hz"} />
}
/>, />,
<Pair <Pair
key="button-cpu" key="button-cpu"
......
...@@ -5,3 +5,11 @@ ...@@ -5,3 +5,11 @@
.button-increment > .value { .button-increment > .value {
margin: 0px 8px 0px 8px; margin: 0px 8px 0px 8px;
} }
.button-increment > .prefix {
margin-left: 8px;
}
.button-increment > .suffix {
margin-right: 8px;
}
...@@ -6,6 +6,8 @@ import "./button-increment.css"; ...@@ -6,6 +6,8 @@ import "./button-increment.css";
type ButtonIncrementProps = { type ButtonIncrementProps = {
value: number; value: number;
delta?: number; delta?: number;
prefix?: string;
suffix?: string;
size?: string; size?: string;
style?: string[]; style?: string[];
onClick?: () => void; onClick?: () => void;
...@@ -15,6 +17,8 @@ type ButtonIncrementProps = { ...@@ -15,6 +17,8 @@ type ButtonIncrementProps = {
export const ButtonIncrement: FC<ButtonIncrementProps> = ({ export const ButtonIncrement: FC<ButtonIncrementProps> = ({
value, value,
delta = 1, delta = 1,
prefix,
suffix,
size = "medium", size = "medium",
style = ["simple", "border"], style = ["simple", "border"],
onClick, onClick,
...@@ -43,7 +47,9 @@ export const ButtonIncrement: FC<ButtonIncrementProps> = ({ ...@@ -43,7 +47,9 @@ export const ButtonIncrement: FC<ButtonIncrementProps> = ({
style={["simple"]} style={["simple"]}
onClick={_onMinusClick} onClick={_onMinusClick}
/> />
{prefix && <span className="prefix">{prefix}</span>}
<span className="value">{valueState}</span> <span className="value">{valueState}</span>
{suffix && <span className="suffix">{suffix}</span>}
<Button <Button
text={"+"} text={"+"}
size={size} size={size}
......
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
} }
.button.simple > span { .button.simple > span {
vertical-align: middle;
display: inline-block; display: inline-block;
vertical-align: middle;
} }
.button.simple.no-text > img { .button.simple.no-text > img {
......
.info { .info {
font-size: 24px; font-size: 24px;
vertical-align: top; vertical-align: top;
} }
.info > dt { .info > dt {
clear: both; clear: both;
float: left; float: left;
margin-top: 12px; margin-top: 12px;
} }
.info > dt:first-of-type { .info > dt:first-of-type {
margin-top: 0px; margin-top: 0px;
} }
.info > dd { .info > dd {
float: right; float: right;
margin-top: 12px; margin-top: 12px;
} }
.info > dd:first-of-type { .info > dd:first-of-type {
margin-top: 0px; margin-top: 0px;
} }
.info::after { .info::after {
clear: both; clear: both;
content: ''; content: '';
display: block; display: block;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment