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

feat: link support for children

parent be1b91c8
No related branches found
No related tags found
1 merge request!8Support for react.js components
Pipeline #1157 passed
import React, { FC } from "react"; import React, { ReactNode, FC } from "react";
import "./link.css"; import "./link.css";
type LinkProps = { type LinkProps = {
text: string; children?: ReactNode;
text?: string;
href?: string; href?: string;
target?: string; target?: string;
style?: 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(" "); const classes = () => ["link", ...style].join(" ");
return ( return (
<a className={classes()} href={href} target={target}> <a className={classes()} href={href} target={target}>
{text} {children || text}
</a> </a>
); );
}; };
......
...@@ -23,7 +23,7 @@ export const Title: FC<TitleProps> = ({ ...@@ -23,7 +23,7 @@ export const Title: FC<TitleProps> = ({
<h1 className={classes()}> <h1 className={classes()}>
{text} {text}
{version && ( {version && (
<Link text={version} href={versionUrl} target="_blank"></Link> <Link href={versionUrl} target="_blank">{version}</Link>
)} )}
{iconSrc && <img className="icon" src={iconSrc} alt="icon" />} {iconSrc && <img className="icon" src={iconSrc} alt="icon" />}
</h1> </h1>
......
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