File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
packages/ra-ui-materialui/src Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ import * as React from 'react';
2
2
import { useState } from 'react' ;
3
3
import { Box } from '@mui/material' ;
4
4
import LabelIcon from '@mui/icons-material/Label' ;
5
-
6
5
import {
7
6
useTranslate ,
8
7
DashboardMenuItem ,
9
8
MenuItemLink ,
10
9
MenuProps ,
11
10
useSidebarState ,
12
11
} from 'react-admin' ;
12
+ import clsx from 'clsx' ;
13
13
14
14
import visitors from '../visitors' ;
15
15
import orders from '../orders' ;
@@ -46,6 +46,10 @@ const Menu = ({ dense = false }: MenuProps) => {
46
46
duration : theme . transitions . duration . leavingScreen ,
47
47
} ) ,
48
48
} }
49
+ className = { clsx ( {
50
+ 'RaMenu-open' : open ,
51
+ 'RaMenu-closed' : ! open ,
52
+ } ) }
49
53
>
50
54
< DashboardMenuItem />
51
55
< SubMenu
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
import { styled } from '@mui/material/styles' ;
3
+ import clsx from 'clsx' ;
3
4
import { ReactElement } from 'react' ;
4
5
import {
5
6
Drawer ,
@@ -40,9 +41,12 @@ export const Sidebar = (props: SidebarProps) => {
40
41
open = { open }
41
42
onClose = { toggleSidebar }
42
43
classes = { SidebarClasses }
43
- className = {
44
- trigger && ! appBarAlwaysOn ? SidebarClasses . appBarCollapsed : ''
45
- }
44
+ className = { clsx (
45
+ trigger && ! appBarAlwaysOn
46
+ ? SidebarClasses . appBarCollapsed
47
+ : '' ,
48
+ open ? OPEN_CLASS : CLOSED_CLASS
49
+ ) }
46
50
{ ...rest }
47
51
>
48
52
< div className = { SidebarClasses . fixed } > { children } </ div >
@@ -75,6 +79,9 @@ export const SidebarClasses = {
75
79
appBarCollapsed : `${ PREFIX } -appBarCollapsed` ,
76
80
} ;
77
81
82
+ const OPEN_CLASS = `${ PREFIX } -open` ;
83
+ const CLOSED_CLASS = `${ PREFIX } -closed` ;
84
+
78
85
const StyledDrawer = styled ( Drawer , {
79
86
name : PREFIX ,
80
87
slot : 'Root' ,
Original file line number Diff line number Diff line change @@ -343,6 +343,7 @@ const createBWTheme = (mode: 'light' | 'dark'): RaThemeOptions => {
343
343
root : {
344
344
margin : `0 ${ SPACING } px` ,
345
345
paddingRight : 0 ,
346
+ paddingLeft : SPACING ,
346
347
borderRadius : 5 ,
347
348
color : isDarkMode ? grey [ '200' ] : common [ 'black' ] ,
348
349
'&.RaMenuItemLink-active' : {
@@ -351,13 +352,16 @@ const createBWTheme = (mode: 'light' | 'dark'): RaThemeOptions => {
351
352
'& .RaMenuItemLink-icon' : {
352
353
minWidth : 30 ,
353
354
} ,
355
+ '.RaMenu-closed &' : {
356
+ margin : `0 0 0 ${ SPACING } px` ,
357
+ } ,
354
358
} ,
355
359
} ,
356
360
} ,
357
361
} ,
358
362
sidebar : {
359
363
width : 195 ,
360
- closedWidth : 50 ,
364
+ closedWidth : 45 ,
361
365
} ,
362
366
} ;
363
367
} ;
You can’t perform that action at this time.
0 commit comments