Skip to content

Commit ee1a372

Browse files
committed
Improve delete button props type.
1 parent fd54978 commit ee1a372

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

packages/ra-ui-materialui/src/button/DeleteButton.tsx

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ import {
1414
import { useThemeProps } from '@mui/material/styles';
1515

1616
import { ButtonProps } from './Button';
17-
import { DeleteWithUndoButton } from './DeleteWithUndoButton';
18-
import { DeleteWithConfirmButton } from './DeleteWithConfirmButton';
17+
import {
18+
DeleteWithUndoButton,
19+
DeleteWithUndoButtonProps,
20+
} from './DeleteWithUndoButton';
21+
import {
22+
DeleteWithConfirmButton,
23+
DeleteWithConfirmButtonProps,
24+
} from './DeleteWithConfirmButton';
1925

2026
/**
2127
* Button used to delete a single record. Added by default by the <Toolbar> of edit and show views.
@@ -95,26 +101,14 @@ export const DeleteButton = <RecordType extends RaRecord = any>(
95101
);
96102
};
97103

98-
export interface DeleteButtonProps<
104+
export type DeleteButtonProps<
99105
RecordType extends RaRecord = any,
100106
MutationOptionsError = unknown,
101-
> extends ButtonProps,
102-
SaveContextValue {
103-
confirmTitle?: React.ReactNode;
104-
confirmContent?: React.ReactNode;
105-
confirmColor?: 'primary' | 'warning';
106-
icon?: React.ReactNode;
107-
mutationMode?: MutationMode;
108-
mutationOptions?: UseMutationOptions<
109-
RecordType,
110-
MutationOptionsError,
111-
DeleteParams<RecordType>
112-
>;
113-
record?: RecordType;
114-
redirect?: RedirectionSideEffect;
115-
resource?: string;
116-
successMessage?: string;
117-
}
107+
> = SaveContextValue &
108+
(
109+
| DeleteWithUndoButtonProps<RecordType, MutationOptionsError>
110+
| DeleteWithConfirmButtonProps<RecordType, MutationOptionsError>
111+
);
118112

119113
const PREFIX = 'RaDeleteButton';
120114

0 commit comments

Comments
 (0)