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

feat: new components

parent 790da06d
No related branches found
No related tags found
1 merge request!8Support for react.js components
Pipeline #1065 passed
...@@ -10,13 +10,18 @@ export const App = () => { ...@@ -10,13 +10,18 @@ export const App = () => {
const getText = () => `Hello World ${count}`; const getText = () => `Hello World ${count}`;
const onClick = () => setCount(count + 1); const onClick = () => setCount(count + 1);
const pairs = () => [ const pairs = () => [
<Pair key="tobias" name={"Tobias"} value={`Count ${count}`}></Pair>, <Pair key="tobias" name={"Tobias"} value={`Count ${count}`} />,
<Pair key="matias" name={"Matias"} value={"3"}></Pair> <Pair key="matias" name={"Matias"} value={"3"} />,
<Pair
key="button"
name={"Button"}
valueNode={<Button text="NEO" size={"large"} style={["simple"]} />}
/>
]; ];
return ( return (
<> <>
<Button text={getText()} onClick={onClick} /> <Button text={getText()} onClick={onClick} />
<Info pairs={pairs()}></Info> <Info pairs={pairs()} />
</> </>
); );
}; };
......
import React, { FC } from "react"; import React, { FC, ReactNode } from "react";
import "./pair.css"; import "./pair.css";
type PairProps = { type PairProps = {
name: string; name: string;
value?: string; value?: string;
valueNode?: ReactNode;
style?: string[]; style?: string[];
onNameClick?: () => void; onNameClick?: () => void;
onValueClick?: () => void; onValueClick?: () => void;
...@@ -13,6 +14,7 @@ type PairProps = { ...@@ -13,6 +14,7 @@ type PairProps = {
export const Pair: FC<PairProps> = ({ export const Pair: FC<PairProps> = ({
name, name,
value, value,
valueNode,
style = [], style = [],
onNameClick, onNameClick,
onValueClick onValueClick
...@@ -26,7 +28,7 @@ export const Pair: FC<PairProps> = ({ ...@@ -26,7 +28,7 @@ export const Pair: FC<PairProps> = ({
{name} {name}
</dt> </dt>
<dd className={classes()} onClick={_onValueClick}> <dd className={classes()} onClick={_onValueClick}>
{value ?? ""} {valueNode ?? value ?? ""}
</dd> </dd>
</> </>
); );
......
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