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';
22import { useState } from 'react' ;
33import { Box } from '@mui/material' ;
44import LabelIcon from '@mui/icons-material/Label' ;
5-
65import {
76 useTranslate ,
87 DashboardMenuItem ,
98 MenuItemLink ,
109 MenuProps ,
1110 useSidebarState ,
1211} from 'react-admin' ;
12+ import clsx from 'clsx' ;
1313
1414import visitors from '../visitors' ;
1515import orders from '../orders' ;
@@ -46,6 +46,10 @@ const Menu = ({ dense = false }: MenuProps) => {
4646 duration : theme . transitions . duration . leavingScreen ,
4747 } ) ,
4848 } }
49+ className = { clsx ( {
50+ 'RaMenu-open' : open ,
51+ 'RaMenu-closed' : ! open ,
52+ } ) }
4953 >
5054 < DashboardMenuItem />
5155 < SubMenu
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
22import { styled } from '@mui/material/styles' ;
3+ import clsx from 'clsx' ;
34import { ReactElement } from 'react' ;
45import {
56 Drawer ,
@@ -40,9 +41,12 @@ export const Sidebar = (props: SidebarProps) => {
4041 open = { open }
4142 onClose = { toggleSidebar }
4243 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+ ) }
4650 { ...rest }
4751 >
4852 < div className = { SidebarClasses . fixed } > { children } </ div >
@@ -75,6 +79,9 @@ export const SidebarClasses = {
7579 appBarCollapsed : `${ PREFIX } -appBarCollapsed` ,
7680} ;
7781
82+ const OPEN_CLASS = `${ PREFIX } -open` ;
83+ const CLOSED_CLASS = `${ PREFIX } -closed` ;
84+
7885const StyledDrawer = styled ( Drawer , {
7986 name : PREFIX ,
8087 slot : 'Root' ,
Original file line number Diff line number Diff line change @@ -343,6 +343,7 @@ const createBWTheme = (mode: 'light' | 'dark'): RaThemeOptions => {
343343 root : {
344344 margin : `0 ${ SPACING } px` ,
345345 paddingRight : 0 ,
346+ paddingLeft : SPACING ,
346347 borderRadius : 5 ,
347348 color : isDarkMode ? grey [ '200' ] : common [ 'black' ] ,
348349 '&.RaMenuItemLink-active' : {
@@ -351,13 +352,16 @@ const createBWTheme = (mode: 'light' | 'dark'): RaThemeOptions => {
351352 '& .RaMenuItemLink-icon' : {
352353 minWidth : 30 ,
353354 } ,
355+ '.RaMenu-closed &' : {
356+ margin : `0 0 0 ${ SPACING } px` ,
357+ } ,
354358 } ,
355359 } ,
356360 } ,
357361 } ,
358362 sidebar : {
359363 width : 195 ,
360- closedWidth : 50 ,
364+ closedWidth : 45 ,
361365 } ,
362366 } ;
363367} ;
You can’t perform that action at this time.
0 commit comments