From 71373d4bd3faa0addb8beb82cf91b186e569b52d Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 23 Dec 2024 02:40:59 +0100 Subject: [PATCH] Remove unused space at bottom of snackbar without description Get rid of unnecessary white space when there is no description to show --- .../core/components/snackbar/SnackbarWithDescription.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/core/components/snackbar/SnackbarWithDescription.tsx b/src/modules/core/components/snackbar/SnackbarWithDescription.tsx index 5cf9fef3..5f47eaf2 100644 --- a/src/modules/core/components/snackbar/SnackbarWithDescription.tsx +++ b/src/modules/core/components/snackbar/SnackbarWithDescription.tsx @@ -7,7 +7,7 @@ */ import { CustomContentProps, SnackbarContent, VariantType } from 'notistack'; -import { ForwardedRef, forwardRef, memo } from 'react'; +import { ForwardedRef, forwardRef, Fragment, memo } from 'react'; import Alert from '@mui/material/Alert'; import AlertTitle from '@mui/material/AlertTitle'; import Button from '@mui/material/Button'; @@ -51,11 +51,13 @@ export const SnackbarWithDescription = memo( ? description?.slice(0, MAX_DESCRIPTION_LENGTH) : description; + const TitleComponent = actualDescription?.length ? AlertTitle : Fragment; + return ( - {message} - {actualDescription}{' '} + {message} + {actualDescription} {isDescriptionTooLong ? (