Skip to content

Commit

Permalink
Merge pull request #5918 from WiXSL/usermenu-css
Browse files Browse the repository at this point in the history
Added global css override key to UserMenu component
  • Loading branch information
fzaninotto committed Feb 16, 2021
2 parents f3f1014 + 19d85bc commit ff9c427
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
19 changes: 19 additions & 0 deletions docs/Buttons.md
Expand Up @@ -334,5 +334,24 @@ To override the style of all instances of `<Button>` using the [material-ui styl

### `<RefreshButton>`
### `<SkipNavigationButton>`

#### CSS API

| Rule name | Description |
| --------------------- | ----------------------------------------------- |
| `skipToContentButton` | Applied to the underlying `MuiButton` component |

To override the style of all instances of `<SkipNavigationButton>` using the [material-ui style overrides](https://material-ui.com/customization/globals/#css), use the `RaSkipNavigationButton` key.

### `<MenuItemLink>`
### `<UserMenu>`

#### CSS API

| Rule name | Description |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `user` | Alternative to using `className`. Applied to the root element |
| `userButton` | Applied to the underlying `MuiButton` component when `useGetIdentity().loaded` is `true` and `useGetIdentity().identity.fullName` is set |
| `avatar` | Applied to the underlying `MuiAvatar` component when `useGetIdentity().avatar` is `true` |

To override the style of all instances of `<UserMenu>` using the [material-ui style overrides](https://material-ui.com/customization/globals/#css), use the `RaUserMenu` key.
23 changes: 13 additions & 10 deletions packages/ra-ui-materialui/src/layout/UserMenu.tsx
Expand Up @@ -6,16 +6,19 @@ import { Tooltip, IconButton, Menu, Button, Avatar } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import AccountCircle from '@material-ui/icons/AccountCircle';

const useStyles = makeStyles(theme => ({
user: {},
userButton: {
textTransform: 'none',
},
avatar: {
width: theme.spacing(4),
height: theme.spacing(4),
},
}));
const useStyles = makeStyles(
theme => ({
user: {},
userButton: {
textTransform: 'none',
},
avatar: {
width: theme.spacing(4),
height: theme.spacing(4),
},
}),
{ name: 'RaUserMenu' }
);

const UserMenu = props => {
const [anchorEl, setAnchorEl] = useState(null);
Expand Down

0 comments on commit ff9c427

Please sign in to comment.