feat: memoized bottom navbar

This commit is contained in:
Mahyar Khanbolooki
2025-07-04 16:57:28 +03:30
parent 43cf76bec2
commit 904f98e202
4 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -68,7 +68,7 @@ type Props = {
toggleMenuState: React.MouseEventHandler<HTMLDivElement> | undefined toggleMenuState: React.MouseEventHandler<HTMLDivElement> | undefined
} }
export function Menu({ menuState, toggleMenuState }: Props) { function Menu({ menuState, toggleMenuState }: Props) {
const menuStateMemo = useMemo(() => menuState, [menuState]); const menuStateMemo = useMemo(() => menuState, [menuState]);
return ( return (
@@ -99,3 +99,5 @@ export function Menu({ menuState, toggleMenuState }: Props) {
</BlurredOverlayContainer> </BlurredOverlayContainer>
) )
} }
export default Menu;
+1 -1
View File
@@ -83,4 +83,4 @@ function BottomNavBar({ }: Props) {
) )
} }
export default BottomNavBar export default React.memo(BottomNavBar)
+1 -1
View File
@@ -19,7 +19,7 @@ type Props = {
function TopBar({ profileDropState, toggleProfileDropState, menuState, toggleMenuState, searchModalState, toggleSearchModalState, nightModeState, toggleNightModeState }: Props) { function TopBar({ profileDropState, toggleProfileDropState, menuState, toggleMenuState, searchModalState, toggleSearchModalState, nightModeState, toggleNightModeState }: Props) {
return ( return (
<div className="p-4"> <div className="p-4">
<div className='bg-white rounded-[15px] w-full h-12 lg:h-24 px-4 sm:p-6 xl:gap-8 items-center flex justify-between overflow-auto'> <div className='bg-white overflow-hidden rounded-2xl w-full h-12 lg:h-24 px-4 sm:p-6 xl:gap-8 items-center flex justify-between overflow-auto'>
<div className='inline-flex justify-between items-center'> <div className='inline-flex justify-between items-center'>
<button className='inline-block xl:hidden' onClick={toggleMenuState}> <button className='inline-block xl:hidden' onClick={toggleMenuState}>
<BurgerMenuIcon /> <BurgerMenuIcon />
@@ -2,7 +2,7 @@
import React, { useState } from 'react' import React, { useState } from 'react'
import TopBar from '../topbar/TopBar' import TopBar from '../topbar/TopBar'
import { Menu } from '../menu/Menu' import Menu from '../menu/Menu'
import BottomNavBar from '../navigation/BottomNavBar' import BottomNavBar from '../navigation/BottomNavBar'
type Props = {} & React.AllHTMLAttributes<HTMLBodyElementEventMap> type Props = {} & React.AllHTMLAttributes<HTMLBodyElementEventMap>