diff --git a/src/components/AdventuresVol/index.js b/src/components/AdventuresVol/index.js index 468ccd6c6b682f..3c8cbfeb6cfa66 100644 --- a/src/components/AdventuresVol/index.js +++ b/src/components/AdventuresVol/index.js @@ -1,27 +1,52 @@ import React from "react"; +import { Link } from "gatsby"; import { HiOutlineChevronRight } from "@react-icons/all-files/hi/HiOutlineChevronRight"; import { AdventuresVolWrapper } from "./adventures-vol.style"; const AdventuresVol = ({ title, description, to, image }) => { + const isExternalOrStatic = + to && + (to.startsWith("http://") || + to.startsWith("https://") || + to.split("?")[0].split("#")[0].toLowerCase().endsWith(".pdf") || + to.startsWith("mailto:")); + + const isMailTo = to && to.startsWith("mailto:"); + + const cardContent = ( +
+

{title}

+
+ +

{description}

+ {to && ( +
+ + Read More + +
+ )} +
+ ); + return ( - -
-

{title}

-
- -

- {description} -

- {to && ( -
- - Read More - -
- )} -
- + {!to ? ( +
{cardContent}
+ ) : isExternalOrStatic ? ( + + {cardContent} + + ) : ( + + {cardContent} + + )}
); }; diff --git a/src/components/HandbookCard/index.js b/src/components/HandbookCard/index.js index cc6cb8c3c64bc2..ce2754e1da3157 100644 --- a/src/components/HandbookCard/index.js +++ b/src/components/HandbookCard/index.js @@ -6,18 +6,16 @@ import { HandbookCardWrapper } from "./HandbookCard.style"; const HandbookCard = ({ title, description, to }) => { return ( - +

{title}

-

- {description} -

+

{description}

{to && (
- + Read More - +
)}