|
@@ -23,6 +23,7 @@ export function useAction({ menuItems, isMobile, isLoggedIn }: UseActionParams)
|
|
|
const menuItemsRef = useRef<Map<string, HTMLButtonElement>>(new Map());
|
|
const menuItemsRef = useRef<Map<string, HTMLButtonElement>>(new Map());
|
|
|
const itemWidthCache = useRef<Map<string, number>>(new Map());
|
|
const itemWidthCache = useRef<Map<string, number>>(new Map());
|
|
|
const loginButtonRef = useRef<HTMLButtonElement>(null);
|
|
const loginButtonRef = useRef<HTMLButtonElement>(null);
|
|
|
|
|
+ const languageButtonRef = useRef<HTMLDivElement>(null);
|
|
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
|
|
const [isMobileMenuClosing, setIsMobileMenuClosing] = useState(false);
|
|
const [isMobileMenuClosing, setIsMobileMenuClosing] = useState(false);
|
|
|
const [isOverflowMenuOpen, setIsOverflowMenuOpen] = useState(false);
|
|
const [isOverflowMenuOpen, setIsOverflowMenuOpen] = useState(false);
|
|
@@ -40,7 +41,10 @@ export function useAction({ menuItems, isMobile, isLoggedIn }: UseActionParams)
|
|
|
const loginBtnWidth = loginButtonRef.current
|
|
const loginBtnWidth = loginButtonRef.current
|
|
|
? loginButtonRef.current.offsetWidth + MENU_ITEM_GAP
|
|
? loginButtonRef.current.offsetWidth + MENU_ITEM_GAP
|
|
|
: 0;
|
|
: 0;
|
|
|
- const containerWidth = container.offsetWidth - loginBtnWidth;
|
|
|
|
|
|
|
+ const langBtnWidth = languageButtonRef.current
|
|
|
|
|
+ ? languageButtonRef.current.offsetWidth + MENU_ITEM_GAP
|
|
|
|
|
+ : 0;
|
|
|
|
|
+ const containerWidth = container.offsetWidth - loginBtnWidth - langBtnWidth;
|
|
|
|
|
|
|
|
let totalWidth = 0;
|
|
let totalWidth = 0;
|
|
|
const visible: NavMenuItem[] = [];
|
|
const visible: NavMenuItem[] = [];
|
|
@@ -149,6 +153,7 @@ export function useAction({ menuItems, isMobile, isLoggedIn }: UseActionParams)
|
|
|
return {
|
|
return {
|
|
|
menuContainerRef,
|
|
menuContainerRef,
|
|
|
loginButtonRef,
|
|
loginButtonRef,
|
|
|
|
|
+ languageButtonRef,
|
|
|
menuItemsRef,
|
|
menuItemsRef,
|
|
|
isMobileMenuOpen,
|
|
isMobileMenuOpen,
|
|
|
isMobileMenuClosing,
|
|
isMobileMenuClosing,
|