diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 988625be..eafb4469 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -1,3 +1,5 @@ +import { mdiInformationOutline } from '@mdi/js' +import Icon from '@mdi/react' import { Box, Container, @@ -10,25 +12,49 @@ import { Typography, useTheme, } from '@mui/material' -import { FooterButtons, FooterLinks, SocialMediaLinks } from '../../constants/footer-consts' - -import { mdiInformationOutline } from '@mdi/js' -import Icon from '@mdi/react' -import React from 'react' +import React, { useEffect, useState } from 'react' import { Link } from 'react-router-dom' +import { + footerButtonBoxStyles, + socialMediaIconBoxStyles, + socialMediaIcons, + socialMediaLinks, +} from '../../constants/footer-consts' import { SUITE_RELEASES } from '../../constants/route-paths' import Version from './Version' -export default function Footer() { +const API_URL = 'https://storage.googleapis.com/camino-suite-static/footer-consts.json' + +const Footer: React.FC = () => { const theme = useTheme() const year = new Date().getFullYear() + + const [footerData, setFooterData] = useState(null) + const [error, setError] = useState(null) + + useEffect(() => { + async function fetchData() { + try { + const response = await fetch(API_URL) + const data = await response.json() + setFooterData(data) + } catch (error) { + setError(error) + } + } + fetchData() + }, []) + + if (error) return
Error loading footer data
+ if (!footerData) return
Loading...
+ return (