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 = () => {
<Pair
key="button-tobias"
name={"Button Increment"}
valueNode={<ButtonIncrement value={200} delta={100} />}
valueNode={
<ButtonIncrement value={200} delta={100} suffix={"Hz"} />
}
/>,
<Pair
key="button-cpu"
......
......@@ -5,3 +5,11 @@
.button-increment > .value {
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";
type ButtonIncrementProps = {
value: number;
delta?: number;
prefix?: string;
suffix?: string;
size?: string;
style?: string[];
onClick?: () => void;
......@@ -15,6 +17,8 @@ type ButtonIncrementProps = {
export const ButtonIncrement: FC<ButtonIncrementProps> = ({
value,
delta = 1,
prefix,
suffix,
size = "medium",
style = ["simple", "border"],
onClick,
......@@ -43,7 +47,9 @@ export const ButtonIncrement: FC<ButtonIncrementProps> = ({
style={["simple"]}
onClick={_onMinusClick}
/>
{prefix && <span className="prefix">{prefix}</span>}
<span className="value">{valueState}</span>
{suffix && <span className="suffix">{suffix}</span>}
<Button
text={"+"}
size={size}
......
......@@ -84,8 +84,8 @@
}
.button.simple > span {
vertical-align: middle;
display: inline-block;
vertical-align: middle;
}
.button.simple.no-text > img {
......
.info {
font-size: 24px;
vertical-align: top;
}
.info > dt {
clear: both;
float: left;
margin-top: 12px;
}
.info > dt:first-of-type {
margin-top: 0px;
}
.info > dd {
float: right;
margin-top: 12px;
}
.info > dd:first-of-type {
margin-top: 0px;
}
.info::after {
clear: both;
content: '';
display: block;
}
.info {
font-size: 24px;
vertical-align: top;
}
.info > dt {
clear: both;
float: left;
margin-top: 12px;
}
.info > dt:first-of-type {
margin-top: 0px;
}
.info > dd {
float: right;
margin-top: 12px;
}
.info > dd:first-of-type {
margin-top: 0px;
}
.info::after {
clear: both;
content: '';
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