diff --git a/src/component/cards/cards.jsx b/src/component/cards/cards.jsx index 3cb22d9..24f2b0c 100644 --- a/src/component/cards/cards.jsx +++ b/src/component/cards/cards.jsx @@ -1,6 +1,5 @@ import React from "react"; import './cards.pcss'; -import Link from "../link/link.jsx"; /** * Nav renders a navigation resource. @@ -10,7 +9,7 @@ import Link from "../link/link.jsx"; const Cards = ({ cards }) => { return
{cards.data.map(({ title, teaserIcon, teaserText, links }, i) => ( - +
@@ -18,7 +17,7 @@ const Cards = ({ cards }) => {
{teaserText}
- +
))}
}; diff --git a/src/component/header/header.jsx b/src/component/header/header.jsx index 24b2e49..c74e168 100644 --- a/src/component/header/header.jsx +++ b/src/component/header/header.jsx @@ -1,7 +1,6 @@ import React from "react"; import Nav from "./../nav/nav.jsx"; import "./header.pcss"; -import Link from "../link/link.jsx"; const Header = ({ menu, links }) => { const edit = links.get('edit-form'); @@ -9,10 +8,10 @@ const Header = ({ menu, links }) => {
}; -export default Header; \ No newline at end of file +export default Header; diff --git a/src/component/link/link.jsx b/src/component/link/link.jsx deleted file mode 100644 index 1d4ccc1..0000000 --- a/src/component/link/link.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from "react"; -import useFollow from "../../hook/follow.js"; - -/** - * Link renders and follows links. - * - * This component uses the "follow" function provided by the Applura client. If the follow function is unavailable, it - * falls back to regular browser navigation. The Applura client automatically manages browser history and handles - * external links by initiating a regular browser navigation. It is not necessary to handle those cases here. - */ -const Link = ({ title, href, className, children}) => { - const follow = useFollow(); - const handleClick = (e) => { - if (follow) { - e.preventDefault(); - follow({ title, href }); - } - }; - return ( - - {children ? children : title} - - ); -}; - -export default Link; diff --git a/src/component/short-cards/short-cards.jsx b/src/component/short-cards/short-cards.jsx index 28b843c..5dc86ac 100644 --- a/src/component/short-cards/short-cards.jsx +++ b/src/component/short-cards/short-cards.jsx @@ -1,6 +1,5 @@ import React from "react"; import "./short-cards.pcss"; -import Link from "./../link/link.jsx"; /** * Nav renders a navigation resource. @@ -18,12 +17,12 @@ const ShortCards = ({ cards }) => { // Check if the resolved link matches the current URL const isActive = linkHref === currentUrl; return ( - +
{title}
- +
); })} diff --git a/src/hook/follow.js b/src/hook/follow.js deleted file mode 100644 index c5e1ac0..0000000 --- a/src/hook/follow.js +++ /dev/null @@ -1,19 +0,0 @@ -import { useContext } from "react"; -import ClientContext from "../context/client.jsx"; - -/** - * useFollow provides the Applura client's "follow" function. - * - * The "follow" function is used to initiate client-side resource navigation. The "follow" function takes a link object - * or URL and fetches its target using the Applura client. Once fetched, the Applura client sends the new resource to - * the application via the event loop started in the Socket component or a problem if one was encountered. "follow" - * returns a promise which resolves to a boolean indicating success or failure. - */ -const useFollow = () => { - const client = useContext(ClientContext); - if (client) { - return client.follow; - } -}; - -export default useFollow;