Skip to content

Commit b8857cd

Browse files
th-267: Fix incorrect resize burger menu (#276)
* th-267: * resize burger menu * th-267: * style for burger menu --------- Co-authored-by: Alina Kupchyk <[email protected]>
1 parent c0e1a0e commit b8857cd

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

frontend/src/libs/components/burger-menu/burger-menu.tsx

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Breakpoint, IconName } from '~/libs/enums/enums.js';
1+
import { IconName } from '~/libs/enums/enums.js';
22
import { getValidClassNames } from '~/libs/helpers/helpers.js';
33
import {
44
useCallback,
@@ -54,8 +54,6 @@ const BurgerMenu: React.FC<Properties> = ({ burgerItems }: Properties) => {
5454
};
5555
}, []);
5656

57-
const isMobile = window.innerWidth <= Breakpoint.MOBILE;
58-
5957
return (
6058
<div
6159
ref={menuReference}
@@ -71,21 +69,18 @@ const BurgerMenu: React.FC<Properties> = ({ burgerItems }: Properties) => {
7169
<ul>
7270
{burgerItems.map((item, index) => (
7371
<li key={index}>
74-
{isMobile ? (
75-
<Icon
76-
iconName={item.icon}
77-
onClick={handleNavigate(item.navigateTo)}
78-
className={styles.menuIcon}
79-
/>
80-
) : (
81-
<Button
82-
frontIcon={item.icon}
83-
isFullWidth
84-
label={item.name}
85-
onClick={handleNavigate(item.navigateTo)}
86-
className={styles.btn}
87-
/>
88-
)}
72+
<Icon
73+
iconName={item.icon}
74+
onClick={handleNavigate(item.navigateTo)}
75+
className={styles.menuIcon}
76+
/>
77+
<Button
78+
frontIcon={item.icon}
79+
isFullWidth
80+
label={item.name}
81+
onClick={handleNavigate(item.navigateTo)}
82+
className={styles.btn}
83+
/>
8984
</li>
9085
))}
9186
</ul>

frontend/src/libs/components/burger-menu/styles.module.scss

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
border-radius: 16px;
2727

2828
.btn {
29-
display: inline-flex;
3029
justify-content: start;
3130
background-color: $blue-dark;
3231
border-radius: 0;
@@ -48,6 +47,10 @@
4847
width: 80px;
4948
background-color: $blue-dark;
5049

50+
.btn {
51+
display: none;
52+
}
53+
5154
li {
5255
padding: 10px 20px;
5356

@@ -57,3 +60,13 @@
5760
}
5861
}
5962
}
63+
64+
@media (width > $screen-size-lg) {
65+
.btn {
66+
display: inline-flex;
67+
}
68+
69+
.menuIcon {
70+
display: none;
71+
}
72+
}

0 commit comments

Comments
 (0)