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