From 9f0ff33e5080824bff9c3796dd8825eeaa56b012 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Fri, 19 Aug 2022 11:05:02 +0100
Subject: [PATCH] feat: link support for children

---
 examples/web/react/components/link/link.tsx   | 15 +++++++++++----
 examples/web/react/components/title/title.tsx |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/examples/web/react/components/link/link.tsx b/examples/web/react/components/link/link.tsx
index e316285b..65046383 100644
--- a/examples/web/react/components/link/link.tsx
+++ b/examples/web/react/components/link/link.tsx
@@ -1,19 +1,26 @@
-import React, { FC } from "react";
+import React, { ReactNode, FC } from "react";
 
 import "./link.css";
 
 type LinkProps = {
-    text: string;
+    children?: ReactNode;
+    text?: string;
     href?: string;
     target?: string;
     style?: string[];
 };
 
-export const Link: FC<LinkProps> = ({ text, href, target, style = [] }) => {
+export const Link: FC<LinkProps> = ({
+    children,
+    text,
+    href,
+    target,
+    style = []
+}) => {
     const classes = () => ["link", ...style].join(" ");
     return (
         <a className={classes()} href={href} target={target}>
-            {text}
+            {children || text}
         </a>
     );
 };
diff --git a/examples/web/react/components/title/title.tsx b/examples/web/react/components/title/title.tsx
index 445e94bb..ff77d1f3 100644
--- a/examples/web/react/components/title/title.tsx
+++ b/examples/web/react/components/title/title.tsx
@@ -23,7 +23,7 @@ export const Title: FC<TitleProps> = ({
         <h1 className={classes()}>
             {text}
             {version && (
-                <Link text={version} href={versionUrl} target="_blank"></Link>
+                <Link href={versionUrl} target="_blank">{version}</Link>
             )}
             {iconSrc && <img className="icon" src={iconSrc} alt="icon" />}
         </h1>
-- 
GitLab