Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change names of the Dialog footer props #1887

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/odyssey-react-mui/src/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export type DialogProps = {
/**
* An optional Button object to be situated in the Dialog footer. Should almost always be of variant `primary`.
*/
callToActionPrimaryComponent?: ReactElement<typeof Button>;
callToActionFirstComponent?: ReactElement<typeof Button>;
/**
* An optional Button object to be situated in the Dialog footer, alongside the `callToActionPrimaryComponent`.
*/
callToActionSecondaryComponent?: ReactElement<typeof Button>;
callToActionSecondComponent?: ReactElement<typeof Button>;
/**
* An optional Button object to be situated in the Dialog footer, alongside the other two `callToAction` components.
*/
callToActionTertiaryComponent?: ReactElement<typeof Button>;
callToActionLastComponent?: ReactElement<typeof Button>;
/**
* The content of the Dialog. May be a `string` or any other `ReactNode` or array of `ReactNode`s.
*/
Expand All @@ -61,9 +61,9 @@ export type DialogProps = {
};

const Dialog = ({
callToActionPrimaryComponent,
callToActionSecondaryComponent,
callToActionTertiaryComponent,
callToActionFirstComponent,
callToActionSecondComponent,
callToActionLastComponent,
children,
isOpen,
onClose,
Expand Down Expand Up @@ -119,13 +119,13 @@ const Dialog = ({
{content}
</DialogContent>

{(callToActionPrimaryComponent ||
callToActionSecondaryComponent ||
callToActionTertiaryComponent) && (
{(callToActionFirstComponent ||
callToActionSecondComponent ||
callToActionLastComponent) && (
<DialogActions>
{callToActionTertiaryComponent}
{callToActionSecondaryComponent}
{callToActionPrimaryComponent}
{callToActionLastComponent}
{callToActionSecondComponent}
{callToActionFirstComponent}
</DialogActions>
)}
</MuiDialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const storybookMeta: Meta<DialogProps> = {
title: "MUI Components/Dialog",
component: Dialog,
argTypes: {
callToActionPrimaryComponent: {
callToActionFirstComponent: {
control: null,
description:
"An optional Button object to be situated in the Dialog footer. Should almost always be of variant `primary`.",
Expand All @@ -37,7 +37,7 @@ const storybookMeta: Meta<DialogProps> = {
},
},
},
callToActionSecondaryComponent: {
callToActionSecondComponent: {
control: null,
description:
"An optional Button object to be situated in the Dialog footer, alongside the `callToActionPrimaryComponent`.",
Expand All @@ -47,7 +47,7 @@ const storybookMeta: Meta<DialogProps> = {
},
},
},
callToActionTertiaryComponent: {
callToActionLastComponent: {
control: null,
description:
"An optional Button object to be situated in the Dialog footer, alongside the other two `callToAction` components.",
Expand Down Expand Up @@ -127,17 +127,17 @@ const DefaultTemplate: StoryObj<DialogProps> = {
<Button variant="primary" onClick={onOpen} text="Open dialog" />
<Dialog
{...props}
callToActionPrimaryComponent={
callToActionFirstComponent={
<Button variant="primary" onClick={onClose} text="Primary action" />
}
callToActionSecondaryComponent={
callToActionSecondComponent={
<Button
variant="secondary"
onClick={onClose}
text="Secondary action"
/>
}
callToActionTertiaryComponent={
callToActionLastComponent={
<Button variant="floating" onClick={onClose} text="Cancel" />
}
onClose={onClose}
Expand Down