Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 38 additions & 30 deletions src/components/LinkComponent.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
import React from 'react'
import PropTypes from "prop-types"
import { Link } from 'gatsby'
import { OutboundLink } from 'gatsby-plugin-google-analytics'
import * as React from "react";
import PropTypes from "prop-types";
import { Link } from "gatsby";
import { OutboundLink } from "gatsby-plugin-google-analytics";

const LinkComponent = class extends React.Component {
render() {
const LinkComponent = ({ href, children, ...rest }) => {
if (!href) {
// render children directly if no href is provided
return <>{children}</>;
}

let { href, children, className, id, ...rest } = this.props;
if (/^(http:\/\/|https:\/\/|www\.)/.test(href)) {
return (
<OutboundLink
href={href}
target="_blank"
rel="noopener noreferrer"
{...rest}
>
{children}
</OutboundLink>
);
}

if(href.match(/^(http:\/\/|https:\/\/|www\.)/)){
return (
<OutboundLink href={href} id={id} className={className} target="_blank" rel="noopener noreferrer" {...rest}>
{children}
</OutboundLink>
)
} else if (href.match(/mailto:/)){
return (
<a href={href} id={id} className={className} {...rest}>
{children}
</a>
)
} else {
return (
<Link to={href} id={id} className={className} {...rest}>
{children}
</Link>
)
}
if (/mailto:/.test(href)) {
return (
<a href={href} {...rest}>
{children}
</a>
);
}
}

return (
<Link to={href} {...rest}>
{children}
</Link>
);
};

LinkComponent.propTypes = {
href: PropTypes.string.isRequired
}
href: PropTypes.string,
children: PropTypes.node.isRequired
};

export default LinkComponent
export default LinkComponent;
2 changes: 2 additions & 0 deletions src/components/PastSummits/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const PAST_SUMMITS = [
background: "/img/summit-landing/cards/summit-asia.png",
date: "September 3 & 4, 2024",
location: "Suwon Convention Center, Suwon, South Korea",
link: "https://youtube.com/playlist?list=PLKqaoAnDyfgqjY-vzt45oayXLa4aLpMRU&feature=shared",
notification: {
text: " ",
button: {
Expand All @@ -36,6 +37,7 @@ const PastSummits = ({ title }) => {
<SummitCard
key={summit.key}
background={summit.background}
link={summit.link}
summit={summit}
/>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SummitCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const SummitCard = ({
background,
summit,
cardStyles,
link = "https://summit2025.openinfra.org",
link
}) => {
if (!summit) return null;

Expand Down
2 changes: 2 additions & 0 deletions src/components/UpcomingSummits/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const UPCOMING_SUMMITS = [
background: "/img/summit-landing/cards/summit-europe-25-2.png",
date: "October 17-19, 2025",
location: "École Polytechnique, Paris-Saclay, France",
link: "https://summit2025.openinfra.org",
notification: {
text: " ",
button: {
Expand All @@ -36,6 +37,7 @@ const UpcomingSummits = ({ title }) => {
<SummitCard
key={summit.key}
background={summit.background}
link={summit.link}
summit={summit}
/>
))}
Expand Down