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   --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
@ -192,8 +192,8 @@ export const MatchColumnsStep = <T extends string>({
|
||||
if (columnIndex === index) {
|
||||
return setColumn(column, field, data);
|
||||
} else if (index === existingFieldIndex) {
|
||||
enqueueSnackBar('Columns cannot duplicate', {
|
||||
title: 'Another column unselected',
|
||||
enqueueSnackBar('Another column unselected', {
|
||||
detailedMessage: 'Columns cannot duplicate',
|
||||
variant: SnackBarVariant.Error,
|
||||
});
|
||||
return setColumn(column);
|
||||
|
||||
@ -51,7 +51,6 @@ export const SpreadsheetImportStepper = ({
|
||||
const handleError = useCallback(
|
||||
(description: string) => {
|
||||
enqueueSnackBar(description, {
|
||||
title: 'Error',
|
||||
variant: SnackBarVariant.Error,
|
||||
});
|
||||
},
|
||||
|
||||
@ -109,8 +109,8 @@ export const DropZone = ({ onContinue, isLoading }: DropZoneProps) => {
|
||||
onDropRejected: (fileRejections) => {
|
||||
setLoading(false);
|
||||
fileRejections.forEach((fileRejection) => {
|
||||
enqueueSnackBar(fileRejection.errors[0].message, {
|
||||
title: `${fileRejection.file.name} upload rejected`,
|
||||
enqueueSnackBar(`${fileRejection.file.name} upload rejected`, {
|
||||
detailedMessage: fileRejection.errors[0].message,
|
||||
variant: SnackBarVariant.Error,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user