import useTranslation from "next-translate/useTranslation"; import Link from "next/link"; import { useRouter } from "next/router"; import { useState } from "react"; export default function Footer(props) { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; var linksArr = props.footerLinks || [{}]; const linksBlock = Object.keys(linksArr).map((key) => (
  • {linksArr[key].title}
  • )); const [showShareState, setShowShareState] = useState(false); const [copySuccess, setCopySuccess] = useState(""); let shareState = () => { showShareState == true ? (setShowShareState(false), setCopySuccess("")) : setShowShareState(true); }; const copyToClipBoard = async (copyMe) => { try { await navigator.clipboard.writeText(copyMe); setCopySuccess(" - " + t("common:social-bar-share-copy-link-done")); } catch (err) { setCopySuccess("Failed to copy!"); } }; const origin = typeof window !== "undefined" && window.location.origin ? window.location.origin : process.env.API_ROOT; const URL = `${origin}`; const shareBodyStr = // t("common:service-home-url") + URL + (locale == "cy" ? "/cy" : "") + (router.route == "/case" || router.route == "/dnsdetails" || router.route == "/myportal/case" ? (router.route == "/dnsdetails" ? "/dns/" : "/case/") + encodeURIComponent(props.ticketnumber) : router.asPath); const shareSubjectStr = t("common:social-shared-from") + " " + t("common:gov-wales-label").toLowerCase(); return ( <> ); }