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

Added global css override key to UserMenu component #5918

Merged
merged 4 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions docs/Buttons.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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