Skip to content

Commit 44adebe

Browse files
authored
Chore/Vertically center text labels in MuiDrawer side menu (FlowiseAI#2954)
* Chore/Vertically center side menu button labels - Some labels, such as 'Agentflows', were not vertically centered in their containers in the side menu (MuiDrawer component). - Fixed the alignment by styling text containers (`<ListItemText>`) with automatic vertical margins. - Maintained existing vertical margins by adding a 4px vertical margin to the primary text element (`<Typography>`). - Note: future work is needed to fix vertical alignment of the BETA chip, plus the margin between primary text elements and the secondary captions should probably be reduced by half. * Chore/Vertically center side menu BETA chips - The 'BETA' chips in the side menu were not vertically centered in their containers in the side menu (MuiDrawer component). - These chips previously appeared to be vertically centered only by coincidence and only when their corresponding text label had no caption. * Chore/Adjust top margin of captions in side menu - Added `mt: -0.6` to the secondary (caption) label to replicate the original gap between the primary and secondary labels. - This adjustment was needed only after the vertical alignment of the primary text labels were fixed in a prior commit.
1 parent 67c119c commit 44adebe

File tree

1 file changed

+8
-2
lines changed
  • packages/ui/src/layout/MainLayout/Sidebar/MenuList/NavItem

1 file changed

+8
-2
lines changed

packages/ui/src/layout/MainLayout/Sidebar/MenuList/NavItem/index.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,22 @@ const NavItem = ({ item, level, navType, onClick, onUploadFile }) => {
114114
<ListItemIcon sx={{ my: 'auto', minWidth: !item?.icon ? 18 : 36 }}>{itemIcon}</ListItemIcon>
115115
<ListItemText
116116
primary={
117-
<Typography variant={customization.isOpen.findIndex((id) => id === item.id) > -1 ? 'h5' : 'body1'} color='inherit'>
117+
<Typography
118+
variant={customization.isOpen.findIndex((id) => id === item.id) > -1 ? 'h5' : 'body1'}
119+
color='inherit'
120+
sx={{ my: 0.5 }}
121+
>
118122
{item.title}
119123
</Typography>
120124
}
121125
secondary={
122126
item.caption && (
123-
<Typography variant='caption' sx={{ ...theme.typography.subMenuCaption }} display='block' gutterBottom>
127+
<Typography variant='caption' sx={{ ...theme.typography.subMenuCaption, mt: -0.6 }} display='block' gutterBottom>
124128
{item.caption}
125129
</Typography>
126130
)
127131
}
132+
sx={{ my: 'auto' }}
128133
/>
129134
{item.chip && (
130135
<Chip
@@ -138,6 +143,7 @@ const NavItem = ({ item, level, navType, onClick, onUploadFile }) => {
138143
{item.isBeta && (
139144
<Chip
140145
sx={{
146+
my: 'auto',
141147
width: 'max-content',
142148
fontWeight: 700,
143149
fontSize: '0.65rem',

0 commit comments

Comments
 (0)