-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9060 from marmelab/9050-fix-delete-button-style
Fix delete button style
- Loading branch information
Showing
3 changed files
with
69 additions
and
40 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
packages/ra-ui-materialui/src/button/DeleteButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { colors, createTheme } from '@mui/material'; | ||
import polyglotI18nProvider from 'ra-i18n-polyglot'; | ||
import englishMessages from 'ra-language-english'; | ||
import frenchMessages from 'ra-language-french'; | ||
import * as React from 'react'; | ||
import { AdminContext } from '../AdminContext'; | ||
import { DeleteButton } from './DeleteButton'; | ||
|
||
const theme = createTheme({ | ||
palette: { | ||
primary: { | ||
light: colors.orange[100], | ||
main: colors.orange[500], | ||
contrastText: colors.grey[50], | ||
}, | ||
error: { | ||
main: colors.orange[500], | ||
}, | ||
}, | ||
}); | ||
|
||
const i18nProvider = polyglotI18nProvider( | ||
locale => (locale === 'fr' ? frenchMessages : englishMessages), | ||
'en' | ||
); | ||
|
||
export default { title: 'ra-ui-materialui/button/DeleteButton' }; | ||
|
||
export const Basic = () => ( | ||
<AdminContext> | ||
<DeleteButton label="Delete" record={{ id: 1 }} /> | ||
</AdminContext> | ||
); | ||
|
||
export const Pessimistic = () => ( | ||
<AdminContext i18nProvider={i18nProvider}> | ||
<DeleteButton | ||
mutationMode="pessimistic" | ||
record={{ id: 1 }} | ||
label="Delete" | ||
resource="post" | ||
/> | ||
</AdminContext> | ||
); | ||
|
||
export const WithUserDefinedPalette = () => ( | ||
<AdminContext theme={theme}> | ||
<DeleteButton label="Delete" record={{ id: 1 }} /> | ||
</AdminContext> | ||
); | ||
|
||
export const ContainedWithUserDefinedPalette = () => ( | ||
<AdminContext theme={theme}> | ||
<DeleteButton | ||
variant="contained" | ||
color="primary" | ||
label="Delete" | ||
record={{ id: 1 }} | ||
/> | ||
</AdminContext> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters