While attempting to build a single page application (SPA), I've encountered an issue with using the Grid
component from material-ui. Normally, I rely heavily on the Grid
, but in this new project, something seems amiss.
The current problem is evident in the image below:
https://i.sstatic.net/mObnC.png
This results in an unwanted margin on the right side along with a pesky horizontal scrollbar.
I understand the negative margin constraint, and following the documentation's advice of applying padding to the parent element does remove the horizontal scrollbar, but it hinders the full-width functionality of my Grid
:
https://i.sstatic.net/nyBNE.png
Removing the horizontal scrollbar creates a padding on the elements, making it difficult to set a background color
that applies to the entire width without any padding.
Adding overflow-x: hidden
introduces a secondary vertical scrollbar that necessitates double vertical scrolling to navigate the page.
Setting Grid spacing={0}
eliminates the problematic scrollbar, but sacrifices the desired spacing between sections and disables the use of spacing
for containers within those sections.
You can see an example of what I'm working on in this codesandbox: https://codesandbox.io/s/competent-volhard-e5yls?file=/src/App.js
My question is, what would be the optimal solution to create a seamless single-page layout with distinct sections, preferably leveraging one of the material-ui components?
Thank you!