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";
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>
);
};
......
......@@ -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>
......
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