-
Notifications
You must be signed in to change notification settings - Fork 4
feat: improve mui styles as figma - sponsor services #239
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: main
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,56 +11,188 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useState } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import T from "i18n-react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import {Button, Box} from '@mui/material'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import styles from "./styles.module.scss" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, {useRef, useState} from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import T from "i18n-react/dist/i18n-react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import {useTheme} from "@mui/material/styles"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Box from "@mui/material/Box"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Button from "@mui/material/Button"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Divider from "@mui/material/Divider"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import IconButton from "@mui/material/IconButton"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ListItemIcon from "@mui/material/ListItemIcon"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ListItemText from "@mui/material/ListItemText"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Menu from "@mui/material/Menu"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import MenuItem from "@mui/material/MenuItem"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Typography from "@mui/material/Typography"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import AccountCircleIcon from "@mui/icons-material/AccountCircle"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import LogoutIcon from "@mui/icons-material/Logout"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import PersonIcon from "@mui/icons-material/Person"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import SettingsIcon from "@mui/icons-material/Settings"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import styles from "./styles.module.scss"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const AuthButton = ({ isLoggedUser, doLogin, initLogOut, picture }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [showLogOut, setShowLogOut] = useState(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const AuthButton = ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isLoggedUser, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| doLogin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initLogOut, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| profileEmail, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| profileName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const theme = useTheme(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const anchorRef = useRef(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [menuOpen, setMenuOpen] = useState(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const toggleLogOut = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setShowLogOut(!showLogOut); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const menuFontSize = theme?.custom?.menu?.fontSize || "1.4rem"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const menuLineHeight = theme?.custom?.menu?.lineHeight || "2rem"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const menuIconColor = theme?.custom?.menu?.icon || theme.palette.text.secondary; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const openMenu = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setMenuOpen(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const closeMenu = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setMenuOpen(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isLoggedUser) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.userMenu} onClick={toggleLogOut}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className={styles.profilePic} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style={{ backgroundImage: `url(${picture})` }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {showLogOut && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className={styles.logout} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variant="contained" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="small" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color="secondary" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Box className={styles.userMenu}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <IconButton | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-controls={menuOpen ? "user-menu" : undefined} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-expanded={menuOpen ? "true" : undefined} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-haspopup="true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={openMenu} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="medium" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data-testid="user-menu-button" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: theme.palette.text.primary, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p: 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 28, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 28 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ref={anchorRef} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <AccountCircleIcon sx={{fontSize: 28}}/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </IconButton> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+58
to
+74
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.
The button contains only an icon with no text. Without an ♿ Proposed fix <IconButton
aria-controls={menuOpen ? "user-menu" : undefined}
aria-expanded={menuOpen ? "true" : undefined}
aria-haspopup="true"
+ aria-label="Open user menu"
onClick={openMenu}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Menu | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id="user-menu" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| anchorEl={anchorRef.current} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| open={menuOpen} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClose={closeMenu} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| anchorOrigin={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vertical: "bottom", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| horizontal: "right" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| transformOrigin={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vertical: "top", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| horizontal: "right" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slotProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paper: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mt: 1.5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| minWidth: 260, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius: 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| overflow: "hidden", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| boxShadow: "0 16px 40px rgba(0, 0, 0, 0.18)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| list: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| disablePadding: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx: {py: 0} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Box sx={{px: 3, py: 2.5}}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variant="body1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize: menuFontSize, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lineHeight: menuLineHeight, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: theme.palette.text.primary, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mb: 0.5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {profileName || "User"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Typography | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variant="body2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize: menuFontSize, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lineHeight: menuLineHeight, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: theme.palette.text.secondary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {profileEmail || ""} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Typography> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Box> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Divider/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <MenuItem onClick={closeMenu} sx={{py: 1.5, px: 3, gap: 1.5}}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ListItemIcon sx={{minWidth: 32, color: menuIconColor}}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <SettingsIcon sx={{fontSize: 24}}/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </ListItemIcon> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ListItemText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primary={T.translate("general.settings")} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primaryTypographyProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize: menuFontSize, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: theme.palette.text.primary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </MenuItem> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <MenuItem onClick={closeMenu} sx={{py: 1.5, px: 3, gap: 1.5}}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ListItemIcon sx={{minWidth: 32, color: menuIconColor}}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PersonIcon sx={{fontSize: 24}}/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </ListItemIcon> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ListItemText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primary={T.translate("general.profile")} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primaryTypographyProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize: menuFontSize, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: theme.palette.text.primary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </MenuItem> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+128
to
+155
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. Settings and Profile menu items are non-functional — missing callback props. Both Add callback props and wire them up: 🐛 Proposed fix const AuthButton = ({
isLoggedUser,
doLogin,
initLogOut,
profileEmail,
- profileName
+ profileName,
+ onSettings,
+ onProfile
}) => {- <MenuItem onClick={closeMenu} sx={{py: 1.5, px: 3, gap: 1.5}}>
+ <MenuItem onClick={() => { closeMenu(); onSettings?.(); }} sx={{py: 1.5, px: 3, gap: 1.5}}>
...
</MenuItem>
- <MenuItem onClick={closeMenu} sx={{py: 1.5, px: 3, gap: 1.5}}>
+ <MenuItem onClick={() => { closeMenu(); onProfile?.(); }} sx={{py: 1.5, px: 3, gap: 1.5}}>🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Divider/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <MenuItem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| closeMenu(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initLogOut(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx={{py: 1.5, px: 3, gap: 1.5}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {T.translate("buttons.sign_out")} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Box className={styles.login}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variant="contained" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="small" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color="secondary" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| doLogin(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {T.translate("buttons.log_in")} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ListItemIcon sx={{minWidth: 32, color: menuIconColor}}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <LogoutIcon sx={{fontSize: 24}}/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </ListItemIcon> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ListItemText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primary={T.translate("buttons.sign_out")} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primaryTypographyProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sx: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize: menuFontSize, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: theme.palette.text.primary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </MenuItem> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Menu> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Box> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Box className={styles.login}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variant="contained" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="small" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color="secondary" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| doLogin(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {T.translate("buttons.log_in")} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Box> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default AuthButton; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,13 @@ | ||
| .userMenu { | ||
| position: absolute; | ||
| top: 12px; | ||
| right: 34px; | ||
| height: 40px; | ||
| width: 140px; | ||
| cursor: pointer; | ||
| top: 50%; | ||
| right: 24px; | ||
| display: flex; | ||
| justify-content: flex-end; | ||
| transform: translateY(-50%); | ||
| } | ||
|
|
||
| .login { | ||
| width: 100%; | ||
| text-align: right; | ||
| } | ||
|
|
||
| .logout { | ||
| top: 4px; | ||
| right: 4px; | ||
| } | ||
|
|
||
| .profilePic { | ||
| height: 40px; | ||
| width: 40px; | ||
| border: 1px solid #afafaf; | ||
| border-radius: 20px; | ||
| overflow: hidden; | ||
| float: right; | ||
| background-size: cover; | ||
| } |
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.
🧩 Analysis chain
🌐 Web query:
MUI Autocomplete v6 InputLabelProps shrink false value overlap behavior💡 Result:
In MUI (Material-UI) v6, the Autocomplete component renders its input via the
renderInputprop, typically a TextField. The TextField's label shrink behavior is controlled by theInputLabelProps={{ shrink: false }}passed to the TextField insiderenderInput.[1][2][3] Settingshrink: falseforces the InputLabel to remain in its expanded (non-shrunk) position inside the input field, regardless of whether the Autocomplete has avalue, isfocused, or has aninputValue.[4][5][6] This can cause the label text to visually overlap with the selected value or input text, as the label does not move to the top border position.[7][8][9][10] This overlap occurs because: - Normally, the label automatically shrinks (viadata-shrink="true") when there is a value, focus, or certain input states, positioning it above the input border.[5] - Withshrink: false, it stays overlaid on the input content.[11] - In Autocomplete, the internalinputValuemay initially be empty even with avalueprop, exacerbating animation/jump issues, though recent v6 fixes (e.g.,#45734,#46047) address shrink animation regressions for controlled values and multiple mode with empty arrays.[12][13][14][15][16] Example causing overlap:<Autocomplete value={someValue} renderInput={(params) => ( <TextField {...params} label="Label" InputLabelProps={{ shrink: false }} // Forces non-shrunk state /> )} />The label will overlap the displayedgetOptionLabel(someValue)or input text.[8][17] To avoid overlap while keeping the label expanded initially: - Use dynamic shrink:InputLabelProps={{ shrink: !!value || focused }}with state for focus.[18] - Or let MUI auto-handle shrink (omitshrink: false), accepting automatic shrinking on value/focus.[5] - CSS hacks like adjustingtopexist but are brittle.[7] Official docs note shrink state isn't always perfect (e.g., number/date inputs), recommending manualshrinkoverride only when needed.[5]Citations:
valueis provided (@imadx) mui/material-ui#45735valueis provided mui/material-ui#45734renderValueis used with empty array in multiple mode mui/material-ui#46047valueto Autocomplete when usingmultipleandrenderValuemui/material-ui#46037🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 910
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 2284
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 1195
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 1131
Prevent label overlap when
disableShrinkis enabled.Passing
{ shrink: false }unconditionally overrides MUI Autocomplete's label management. When a value is present anddisableShrinkistrue, the label stays in its resting position and overlaps the displayed text. Applyshrink: falseonly when there is no value:Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents