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

refactor: better panel split

parent 516a2cfb
No related branches found
No related tags found
1 merge request!8Support for react.js components
Pipeline #1153 passed
......@@ -7,6 +7,7 @@ import {
ButtonSwitch,
Info,
Pair,
PanelSplit,
Section
} from "./components";
......@@ -18,47 +19,49 @@ export const App = () => {
const onClick = () => setCount(count + 1);
return (
<>
<Section>
<Button text={getText()} onClick={onClick} />
<Button
text={getText()}
image={require("../res/pause.svg")}
imageAlt="tobias"
onClick={onClick}
/>
<Info>
<Pair
key="tobias"
name={"Tobias"}
value={`Count ${count}`}
<PanelSplit>
<Section>
<Button text={getText()} onClick={onClick} />
<Button
text={getText()}
image={require("../res/pause.svg")}
imageAlt="tobias"
onClick={onClick}
/>
<Pair key="matias" name={"Matias"} value={"3"} />
<Pair
key="button-tobias"
name={"Button Increment"}
valueNode={
<ButtonIncrement
value={200}
delta={100}
min={0}
suffix={"Hz"}
/>
}
/>
<Pair
key="button-cpu"
name={"Button Switch"}
valueNode={
<ButtonSwitch
options={["NEO", "CLASSIC"]}
size={"large"}
style={["simple"]}
onChange={(v) => alert(v)}
/>
}
/>
</Info>
</Section>
<Info>
<Pair
key="tobias"
name={"Tobias"}
value={`Count ${count}`}
/>
<Pair key="matias" name={"Matias"} value={"3"} />
<Pair
key="button-tobias"
name={"Button Increment"}
valueNode={
<ButtonIncrement
value={200}
delta={100}
min={0}
suffix={"Hz"}
/>
}
/>
<Pair
key="button-cpu"
name={"Button Switch"}
valueNode={
<ButtonSwitch
options={["NEO", "CLASSIC"]}
size={"large"}
style={["simple"]}
onChange={(v) => alert(v)}
/>
}
/>
</Info>
</Section>
</PanelSplit>
</>
);
};
......
.panel-split {
display: flex;
}
.panel-split > .side-left {
text-align: center;
flex: 1 0;
justify-content: center;
display: flex;
}
.panel-split > .side-right {
max-width: 100%;
min-width: 580px;
flex: 0;
padding: 0px 24px 0px 24px;
}
.panel-split {
display: flex;
}
.panel-split > .side-left {
display: flex;
flex: 1 0;
justify-content: center;
text-align: center;
}
.panel-split > .side-right {
flex: 0;
max-width: 100%;
min-width: 580px;
padding: 0px 24px 0px 24px;
}
......@@ -3,13 +3,25 @@ import React, { FC, ReactNode } from "react";
import "./panel-split.css";
type PanelSplitProps = {
children: ReactNode;
children?: ReactNode;
left?: ReactNode;
right?: ReactNode;
style?: string[];
};
export const PanelSplit: FC<PanelSplitProps> = ({ children, style = [] }) => {
export const PanelSplit: FC<PanelSplitProps> = ({
children,
left,
right,
style = []
}) => {
const classes = () => ["panel-split", ...style].join(" ");
return <></>;
return (
<div className={classes()}>
<div className="side-left">{left}</div>
<div className="side-right">{children || right}</div>
</div>
);
};
export default PanelSplit;
.section > .separator {
height: 2px;
background: #ffffff;
margin: 22px 0px 22px 0px;
}
.section > .separator {
background: #ffffff;
height: 2px;
margin: 22px 0px 22px 0px;
}
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