From 7103503a6549863e756c40965f2c809773dfb807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Mon, 18 Jul 2022 09:44:03 +0100 Subject: [PATCH] feat: new components --- examples/web/react/app.tsx | 11 ++++++++--- examples/web/react/components/pair/pair.tsx | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/web/react/app.tsx b/examples/web/react/app.tsx index 0603a554..546233a5 100644 --- a/examples/web/react/app.tsx +++ b/examples/web/react/app.tsx @@ -10,13 +10,18 @@ export const App = () => { const getText = () => `Hello World ${count}`; const onClick = () => setCount(count + 1); const pairs = () => [ - <Pair key="tobias" name={"Tobias"} value={`Count ${count}`}></Pair>, - <Pair key="matias" name={"Matias"} value={"3"}></Pair> + <Pair key="tobias" name={"Tobias"} value={`Count ${count}`} />, + <Pair key="matias" name={"Matias"} value={"3"} />, + <Pair + key="button" + name={"Button"} + valueNode={<Button text="NEO" size={"large"} style={["simple"]} />} + /> ]; return ( <> <Button text={getText()} onClick={onClick} /> - <Info pairs={pairs()}></Info> + <Info pairs={pairs()} /> </> ); }; diff --git a/examples/web/react/components/pair/pair.tsx b/examples/web/react/components/pair/pair.tsx index 4b19c469..9e032e85 100644 --- a/examples/web/react/components/pair/pair.tsx +++ b/examples/web/react/components/pair/pair.tsx @@ -1,10 +1,11 @@ -import React, { FC } from "react"; +import React, { FC, ReactNode } from "react"; import "./pair.css"; type PairProps = { name: string; value?: string; + valueNode?: ReactNode; style?: string[]; onNameClick?: () => void; onValueClick?: () => void; @@ -13,6 +14,7 @@ type PairProps = { export const Pair: FC<PairProps> = ({ name, value, + valueNode, style = [], onNameClick, onValueClick @@ -26,7 +28,7 @@ export const Pair: FC<PairProps> = ({ {name} </dt> <dd className={classes()} onClick={_onValueClick}> - {value ?? ""} + {valueNode ?? value ?? ""} </dd> </> ); -- GitLab