-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix: TimeZone dropdown clips through screen in Mobile viewport #7935
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR addresses the timezone dropdown clipping and transparency issues in mobile viewports by introducing responsive width adjustments to the Dropdown and DropdownMenu components.
- Added 'mobileDropdownWidth' prop to Dropdown.tsx for viewport-specific width control
- Implemented MOBILE_VIEWPORT constant in DropdownMenu.tsx to determine appropriate width
- Modified DropdownMenu styling to reduce transparency and improve visibility
- Adjusted dropdown width calculation in Dropdown.tsx to consider mobile viewport
- Ensured full-width rendering for desktop filters dropdown as per issue requirements
2 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
const dropdownWidth = | ||
mobileDropdownWidth && window.innerWidth <= MOBILE_VIEWPORT | ||
? mobileDropdownWidth | ||
: dropdownMenuWidth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: This logic might cause issues if window is undefined in SSR environments
useDropdown(dropdownId); | ||
|
||
const offsetMiddlewares = []; | ||
const dropdownWidth = | ||
mobileDropdownWidth && window.innerWidth <= MOBILE_VIEWPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider using a hook like useMediaQuery for responsive behavior instead of directly checking window.innerWidth
@@ -1,9 +1,10 @@ | |||
import styled from '@emotion/styled'; | |||
|
|||
import { MOBILE_VIEWPORT } from 'twenty-ui'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider using a more specific import for MOBILE_VIEWPORT
width: ${({ width = 160 }) => | ||
typeof width === 'number' ? `${width}px` : width}; | ||
width: ${({ width = 160, mobileDropdownWidth }) => { | ||
const isMobileViewport = MOBILE_VIEWPORT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: MOBILE_VIEWPORT is likely a boolean, not a function. Remove unnecessary const assignment
typeof width === 'number' ? `${width}px` : width}; | ||
width: ${({ width = 160, mobileDropdownWidth }) => { | ||
const isMobileViewport = MOBILE_VIEWPORT; | ||
if (Boolean(isMobileViewport) && Boolean(mobileDropdownWidth)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Unnecessary Boolean() wrapping, MOBILE_VIEWPORT is already a boolean
width: ${({ width = 160, mobileDropdownWidth }) => { | ||
const isMobileViewport = MOBILE_VIEWPORT; | ||
if (Boolean(isMobileViewport) && Boolean(mobileDropdownWidth)) { | ||
return typeof mobileDropdownWidth === 'number' | ||
? `${mobileDropdownWidth}px` | ||
: mobileDropdownWidth; | ||
} | ||
return typeof width === 'number' ? `${width}px` : width; | ||
}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider extracting this logic into a separate function for better readability
Description