Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mobile styling #4430

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/src/Style.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const style = {}
const sidebarWidth = 250

style.container = {
display: 'flex',
flexDirection: 'row', // Default value for non-mobile devices
}

style.menu = {
position: 'fixed',
display: 'flex',
Expand All @@ -9,8 +14,6 @@ style.menu = {
bottom: 0,
left: 0,
width: sidebarWidth,
// match menu background
// prevents a white background when items are filtered out by search
background: '#1B1C1D',
overflowX: 'hidden',
}
Expand All @@ -25,4 +28,13 @@ style.main = {
maxWidth: parseInt(sidebarWidth, 10) + 900,
}

// Manually check the screen size and apply appropriate styles
const screenWidth = window.innerWidth
if (screenWidth <= 768) {
style.container.flexDirection = 'column'
style.menu.position = 'relative'
style.menu.width = '100%'
style.sidebarMain.marginLeft = '0%'
}
Comment on lines +31 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@highsmithcodes we can't really on window there as it's unsafe for SSR 😢


export default style