|
1 | 1 | import * as React from 'react'; |
2 | 2 | import { createTheme } from '@mui/material'; |
3 | | -import type { PaletteColor } from '@mui/material'; |
4 | 3 | import { DeleteButton } from './DeleteButton'; |
5 | | -import { Form } from 'ra-core'; |
6 | 4 | import { AdminContext } from '../AdminContext'; |
7 | 5 |
|
8 | 6 | export default { title: 'ra-ui-materialui/button/DeleteButton' }; |
9 | 7 |
|
10 | 8 | export const Basic = () => ( |
11 | 9 | <AdminContext> |
12 | | - <Form record={{ id: 1 }}> |
13 | | - <DeleteButton label="Delete" /> |
14 | | - </Form> |
| 10 | + <DeleteButton label="Delete" record={{ id: 1 }} /> |
| 11 | + </AdminContext> |
| 12 | +); |
| 13 | + |
| 14 | +export const Pessimistic = () => ( |
| 15 | + <AdminContext> |
| 16 | + <DeleteButton |
| 17 | + mutationMode="pessimistic" |
| 18 | + record={{ id: 1 }} |
| 19 | + label="Delete" |
| 20 | + resource="post" |
| 21 | + /> |
15 | 22 | </AdminContext> |
16 | 23 | ); |
17 | 24 |
|
18 | 25 | export const WithUserDefinedPalette = () => ( |
19 | 26 | <AdminContext theme={theme}> |
20 | | - <Form record={{ id: 1 }}> |
21 | | - <DeleteButton label="Delete" /> |
22 | | - </Form> |
| 27 | + <DeleteButton label="Delete" record={{ id: 1 }} /> |
23 | 28 | </AdminContext> |
24 | 29 | ); |
25 | 30 |
|
26 | | -/** |
27 | | - * Adding new theme tokens to the palette |
28 | | - * @see https://mui.com/material-ui/experimental-api/css-theme-variables/customization/#typescript |
29 | | - */ |
30 | 31 | const theme = createTheme({ |
31 | 32 | palette: { |
32 | 33 | error: { |
33 | | - main: '#FDDBD3', |
| 34 | + main: '#07BA8F', |
34 | 35 | }, |
35 | 36 | }, |
36 | 37 | }); |
37 | | - |
38 | | -declare module '@mui/material/styles' { |
39 | | - interface Palette { |
40 | | - userDefined?: PaletteColor; |
41 | | - } |
42 | | - interface PaletteOptions { |
43 | | - userDefined?: PaletteColor; |
44 | | - } |
45 | | -} |
46 | | - |
47 | | -/** |
48 | | - * Adding new theme tokens to the Button |
49 | | - * https://mui.com/material-ui/customization/theme-components/#creating-new-component-variants |
50 | | - */ |
51 | | -declare module '@mui/material/Button' { |
52 | | - interface ButtonPropsColorOverrides { |
53 | | - userDefined: true; |
54 | | - } |
55 | | -} |
0 commit comments