feat: Refactor home page components

This commit is contained in:
Wini_Fy
2026-02-05 21:20:12 +07:00
parent 2a475901cc
commit 03263d5fb1
6 changed files with 149 additions and 64 deletions

View File

@@ -22,7 +22,13 @@ const FooterBottom = () => {
loadFooterData();
}, []);
const { bottom } = data;
// Ensure we always have a valid `bottom` object, even if API shape changes
const bottom = data?.bottom || footerData.bottom;
// If bottom is still missing, avoid rendering to prevent runtime errors
if (!bottom) {
return null;
}
return (
<div className="footer-bottom">

View File

@@ -22,10 +22,19 @@ const FooterTop = () => {
loadFooterData();
}, []);
const { top } = data;
// Ensure we always have a valid `top` object, even if API shape changes
const top = data?.top || footerData.top;
// If for some reason `top` is still missing, avoid rendering to prevent runtime errors
if (!top) {
return null;
}
return (
<footer className="footer-section fix bg-cover" style={{ backgroundImage: `url('${top.bgImage}')` }}>
<footer
className="footer-section fix bg-cover"
style={top.bgImage ? { backgroundImage: `url('${top.bgImage}')` } : undefined}
>
<div className="container">
<div className="footer-wrapper">
<div className="row">