-
Notifications
You must be signed in to change notification settings - Fork 5.9k
fix(sidebar): keep language and theme controls visible in mobile drawer (fixes #3690) #3728
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { Icon, Button, MenuTrigger, Popover, Grid, Text, Dialog, Row } from '@umami/react-zen'; | ||
| import { languages } from '@/lib/lang'; | ||
| import { useLocale } from '@/components/hooks'; | ||
| import { Globe } from 'lucide-react'; | ||
| import { ThemeButton } from '@umami/react-zen'; | ||
|
|
||
| export function MobileLanguageButton() { | ||
| const { locale, saveLocale } = useLocale(); | ||
| const items = Object.keys(languages).map(key => ({ ...languages[key], value: key })); | ||
|
|
||
| function handleSelect(value: string) { | ||
| saveLocale(value); | ||
| } | ||
|
|
||
| return ( | ||
| <Row | ||
| style={{ | ||
| position: 'fixed', | ||
| bottom: 0, | ||
| left: 0, | ||
| padding: 16, | ||
| backgroundColor: 'var(--background)', | ||
| borderTop: '1px solid var(--border)', | ||
| gap: 8, | ||
| justifyContent: 'center', | ||
| zIndex: 1000, | ||
| }} | ||
|
Comment on lines
+18
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Prompt To Fix With AIThis is a comment left during a code review.
Path: src/components/input/MobileLanguageButton.tsx
Line: 18:27
Comment:
**logic:** `position: fixed` positions relative to the viewport, not the modal/dialog container. This will place the button bar at the bottom of the entire screen rather than within the mobile drawer, potentially overlapping other page content when the drawer is open.
How can I resolve this? If you propose a fix, please make it concise. |
||
| > | ||
| <MenuTrigger> | ||
| <Button variant="quiet"> | ||
| <Icon> | ||
| <Globe /> | ||
| </Icon> | ||
| </Button> | ||
| <Popover | ||
| placement="top" | ||
| style={{ | ||
| width: '75vw', | ||
| maxWidth: '100vw', | ||
| left: '0 !important', | ||
| right: '0 !important', | ||
| marginBottom: 16, | ||
| position: 'fixed', | ||
| }} | ||
|
Comment on lines
+40
to
+44
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Using Prompt To Fix With AIThis is a comment left during a code review.
Path: src/components/input/MobileLanguageButton.tsx
Line: 40:44
Comment:
**style:** Using `!important` and setting both `left` and `right` to 0 is unusual. The popover positioning may conflict with the fixed positioning of the parent Row, causing rendering issues or misalignment.
How can I resolve this? If you propose a fix, please make it concise. |
||
| > | ||
| <Dialog variant="menu" style={{ maxHeight: '60vh', overflowY: 'auto' }}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Using Prompt To Fix With AIThis is a comment left during a code review.
Path: src/components/input/MobileLanguageButton.tsx
Line: 46:46
Comment:
**style:** Using `maxHeight: '60vh'` with `overflowY: 'auto'` inside a modal that's already constrained may cause scrolling issues if the language list is long and combined with the fixed bottom positioning.
How can I resolve this? If you propose a fix, please make it concise. |
||
| <Grid columns="1fr" gap={1} style={{ padding: '8px 0' }}> | ||
| {items.map(({ value, label }) => ( | ||
| <Button | ||
| key={value} | ||
| variant="quiet" | ||
| onPress={() => handleSelect(value)} | ||
| style={{ | ||
| padding: '16px 24px', | ||
| justifyContent: 'flex-start', | ||
| minHeight: '48px', | ||
| }} | ||
| > | ||
| <Text | ||
| weight={value === locale ? 'bold' : 'medium'} | ||
| color={value === locale ? undefined : 'muted'} | ||
| > | ||
| {label} | ||
| </Text> | ||
| </Button> | ||
| ))} | ||
| </Grid> | ||
| </Dialog> | ||
| </Popover> | ||
| </MenuTrigger> | ||
| <ThemeButton /> | ||
| </Row> | ||
| ); | ||
| } | ||
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: Missing
right: 0orwidth: 100%means the bar won't stretch full width across the screen.Prompt To Fix With AI