Skip to content

Commit 325c8d3

Browse files
authored
Merge pull request #3897 from LiteFarmOrg/LF-4948-snackbar-should-be-full-width-and-centered-on-mobile
Lf 4948 snackbar should be full width and centered on mobile
2 parents b7cf98b + a7c9f5e commit 325c8d3

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

packages/webapp/src/App.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ function App() {
4949
horizontal: 'center',
5050
}}
5151
classes={{
52-
root: clsx(styles.root, isCompactSideMenu ? styles.isCompact : styles.isExpanded),
53-
containerRoot: styles[`containerRoot${isCompactSideMenu ? 'WithCompactMenu' : ''}`],
52+
root: clsx(styles.root, isCompactSideMenu && styles.compactRoot),
53+
containerRoot: clsx(
54+
styles.containerRoot,
55+
isCompactSideMenu && styles.compactContainerRoot,
56+
),
5457
}}
5558
// https://notistack.com/features/customization#custom-component
5659
Components={{ common: NotistackSnackbar }}

packages/webapp/src/assets/variables.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
--global-compact-side-menu-width: 80px;
99
// 249px = 24px form padding + 41px form title and progress + 24px margin + 24px call to action + 16 px margin + 24px margin + 24 px padding + 48px button + 24 px padding
1010
--global-multi-step-task-layout-aggregated-height: 249px;
11-
}
1211

13-
@include xs-breakpoint {
14-
:root {
12+
@include xs-breakpoint {
1513
--global-navbar-height: 55px;
1614
--global-side-menu-width: 0px;
15+
--global-compact-side-menu-width: 0px;
1716
}
1817
}

packages/webapp/src/components/Navigation/SideMenu/index.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,14 @@ const PureSideMenu = ({
215215

216216
useLayoutEffect(() => {
217217
const rootElement = document.querySelector(':root');
218-
if (selectedLanguage.includes('ml')) {
218+
if (isMobile) {
219+
rootElement.style.setProperty('--global-side-menu-width', '0px');
220+
} else if (selectedLanguage.includes('ml')) {
219221
rootElement.style.setProperty('--global-side-menu-width', '224px');
220222
} else {
221223
rootElement.style.setProperty('--global-side-menu-width', '188px');
222224
}
223-
}, [selectedLanguage]);
225+
}, [selectedLanguage, isMobile]);
224226

225227
const toggleSideMenu = () => {
226228
setHasBeenExpanded(isCompact);

packages/webapp/src/styles.module.scss

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,21 @@
3737
max-width: 100%;
3838
}
3939

40-
@include sm-breakpoint {
41-
.containerRoot {
42-
left: calc((100vw - var(--global-side-menu-width)) / 2 + var(--global-side-menu-width));
43-
}
44-
.containerRootWithCompactMenu {
40+
.containerRoot {
41+
align-items: center;
42+
left: calc((100vw - var(--global-side-menu-width)) / 2 + var(--global-side-menu-width));
43+
44+
&.compactContainerRoot {
4545
left: calc((100vw - var(--global-compact-side-menu-width)) / 2 + var(--global-compact-side-menu-width));
46-
}
46+
}
4747
}
4848

4949
.root {
5050
max-width: calc(1024px - 48px);
51+
width: calc((100vw - var(--global-side-menu-width)) - 48px);
5152

52-
&.isCompact {
53+
&.compactRoot {
5354
width: calc((100vw - var(--global-compact-side-menu-width)) - 48px);
5455
}
55-
&.isExpanded {
56-
width: calc((100vw - var(--global-side-menu-width)) - 48px);
57-
}
5856
}
5957
}

0 commit comments

Comments
 (0)