Refactor SnackBar API (#9276)

Resolves #9259

## Changes
- Simplified API by removing `title` prop in favor of required `message`
prop
- Added `detailedMessage` prop for supporting additional context
- Updated styling for improved message display
- Renamed `defaultTitleByVariant` to `defaultAriaLabelByVariant` for
clarity
- Adjusted header alignment and icon styling

## Testing
- [x] Verified all SnackBar variants display correctly
- [x] Tested with and without detailed messages
- [x] Checked responsive behavior

## Screenshots

![SnackBar1](https://github.com/user-attachments/assets/fd0e222e-54c1-4cd7-b685-6d18efd6a681)

![SnackBar2](https://github.com/user-attachments/assets/bd1598b4-0f99-44c0-9ba1-6801b2959e3b)

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
Samyak Piya
2024-12-30 06:19:04 -05:00
committed by GitHub
parent 578ba97dad
commit 0fa59d7718
8 changed files with 52 additions and 36 deletions

View File

@ -52,19 +52,17 @@ export const RecordShowPageWorkflowHeader = ({
assertWorkflowWithCurrentVersionIsDefined(workflowWithCurrentVersion);
if (!canWorkflowBeTested) {
enqueueSnackBar(
'Trigger type should be Manual - when no record(s) are selected',
{
variant: SnackBarVariant.Error,
title: 'Workflow cannot be tested',
icon: (
<IconSettingsAutomation
size={16}
color={theme.snackBar.error.color}
/>
),
},
);
enqueueSnackBar('Workflow cannot be tested', {
variant: SnackBarVariant.Error,
detailedMessage:
'Trigger type should be Manual - when no record(s) are selected',
icon: (
<IconSettingsAutomation
size={16}
color={theme.snackBar.error.color}
/>
),
});
return;
}