update text on header logo

- set to black when sticky mode
This commit is contained in:
Wikzyy
2025-04-16 15:27:17 +07:00
parent 910ef6da89
commit a74a2b42bb

View File

@ -19,6 +19,16 @@ const HeaderLogo = () => {
const { pathname } = useLocation(); const { pathname } = useLocation();
const { isRTL } = useLanguage(); const { isRTL } = useLanguage();
const [selectedMenuItem, setSelectedMenuItem] = useState(MENU_ROOT[0]); const [selectedMenuItem, setSelectedMenuItem] = useState(MENU_ROOT[0]);
const [isSticky, setIsSticky] = useState(false);
useEffect(() => {
const handleScroll = () => {
setIsSticky(window.scrollY > 100);
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);
useEffect(() => { useEffect(() => {
MENU_ROOT.forEach((item) => { MENU_ROOT.forEach((item) => {
@ -55,7 +65,9 @@ const HeaderLogo = () => {
</Link> </Link>
<div className="flex items-center"> <div className="flex items-center">
<h3 className="text-gray-50 text-xl hidden md:block">TPAY Dashboard Portal</h3> <h3 className={`text-xl hidden md:block ${isSticky ? 'text-black' : 'text-gray-50'}`}>
TPAY Dashboard Portal
</h3>
</div> </div>
</div> </div>
); );