Chore/Vertically center text labels in MuiDrawer side menu (#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.
This commit is contained in:
Kyle Nakamura
2024-08-07 03:47:30 -07:00
committed by GitHub
parent 67c119c1ca
commit 44adebe953
@@ -114,17 +114,22 @@ const NavItem = ({ item, level, navType, onClick, onUploadFile }) => {
<ListItemIcon sx={{ my: 'auto', minWidth: !item?.icon ? 18 : 36 }}>{itemIcon}</ListItemIcon>
<ListItemText
primary={
<Typography variant={customization.isOpen.findIndex((id) => id === item.id) > -1 ? 'h5' : 'body1'} color='inherit'>
<Typography
variant={customization.isOpen.findIndex((id) => id === item.id) > -1 ? 'h5' : 'body1'}
color='inherit'
sx={{ my: 0.5 }}
>
{item.title}
</Typography>
}
secondary={
item.caption && (
<Typography variant='caption' sx={{ ...theme.typography.subMenuCaption }} display='block' gutterBottom>
<Typography variant='caption' sx={{ ...theme.typography.subMenuCaption, mt: -0.6 }} display='block' gutterBottom>
{item.caption}
</Typography>
)
}
sx={{ my: 'auto' }}
/>
{item.chip && (
<Chip
@@ -138,6 +143,7 @@ const NavItem = ({ item, level, navType, onClick, onUploadFile }) => {
{item.isBeta && (
<Chip
sx={{
my: 'auto',
width: 'max-content',
fontWeight: 700,
fontSize: '0.65rem',