-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made changes reflecting the review given for PR #160
- Loading branch information
Thai
committed
Oct 3, 2020
1 parent
e046c36
commit 5378dce
Showing
9 changed files
with
136 additions
and
115 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
|
||
import { ButtonProps } from '../buttons/Button'; | ||
|
||
import { ButtonWithModal, ModalTitleContentProps } from './ButtonWithModal'; | ||
|
||
export interface AlertModalProps extends ModalTitleContentProps { | ||
closeButtonProps: ButtonProps; | ||
} | ||
|
||
export interface ButtonWithAlertModalProps extends ButtonProps { | ||
alertModalProps: AlertModalProps; | ||
} | ||
|
||
export const ButtonWithAlertModal = ({ | ||
alertModalProps, | ||
name, | ||
...otherButtonProps | ||
}: ButtonWithAlertModalProps) => { | ||
const { | ||
closeButtonProps, | ||
...modalTitleContentProps | ||
}: AlertModalProps = alertModalProps; | ||
|
||
return ( | ||
<ButtonWithModal | ||
modalTitleContentProps={modalTitleContentProps} | ||
name={name} | ||
actionButtonPropsList={[{ name: 'Close', ...closeButtonProps }]} | ||
{...otherButtonProps} | ||
/> | ||
); | ||
}; |
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,39 @@ | ||
import React from 'react'; | ||
|
||
import { ButtonProps } from '../buttons/Button'; | ||
|
||
import { ButtonWithModal, ModalTitleContentProps } from './ButtonWithModal'; | ||
|
||
export interface ConfirmationModalProps extends ModalTitleContentProps { | ||
confirmButtonProps: ButtonProps; | ||
cancelButtonProps: ButtonProps; | ||
} | ||
|
||
export interface ButtonWithConfirmationModalProps extends ButtonProps { | ||
confirmationModalProps: ConfirmationModalProps; | ||
} | ||
|
||
export const ButtonWithConfirmationModal = ({ | ||
confirmationModalProps, | ||
name, | ||
onClick, | ||
...otherButtonProps | ||
}: ButtonWithConfirmationModalProps) => { | ||
const { | ||
cancelButtonProps, | ||
confirmButtonProps, | ||
...modalTitleContentProps | ||
}: ConfirmationModalProps = confirmationModalProps; | ||
|
||
return ( | ||
<ButtonWithModal | ||
modalTitleContentProps={modalTitleContentProps} | ||
name={name} | ||
actionButtonPropsList={[ | ||
{ name: 'Cancel', ...cancelButtonProps }, | ||
{ name: 'Confirm', onClick, ...confirmButtonProps }, | ||
]} | ||
{...otherButtonProps} | ||
/> | ||
); | ||
}; |
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
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,8 @@ | ||
The component abstraction level for for modals goes (from lowest to highest level): | ||
|
||
1. BaseModal | ||
2. ModalWithActionButtons | ||
3. ButtonWithModal | ||
4. ButtonWithAlertModal, ButtonWithConfirmationModal | ||
|
||
The (i+1)-th component depends on the i-th component. |
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 |
---|---|---|
@@ -1,56 +1,2 @@ | ||
import React from 'react'; | ||
|
||
import { ButtonWithModal } from './ButtonWithModal'; | ||
import { ActionButton } from './ModalWithActionButtons'; | ||
|
||
export interface ButtonConfirmationModalProps { | ||
modalTitle: string; | ||
modalContentText: string; | ||
name: string; | ||
confirmButtonProps: ActionButton; | ||
cancelButtonProps: ActionButton; | ||
} | ||
|
||
export const ButtonWithConfirmationModal = ({ | ||
modalTitle, | ||
modalContentText, | ||
name, | ||
confirmButtonProps, | ||
cancelButtonProps, | ||
...otherOpenButtonProps | ||
}: ButtonConfirmationModalProps) => { | ||
return ( | ||
<ButtonWithModal | ||
modalTitle={modalTitle} | ||
modalContentText={modalContentText} | ||
name={name} | ||
actionButtonList={[cancelButtonProps, confirmButtonProps]} | ||
{...otherOpenButtonProps} | ||
/> | ||
); | ||
}; | ||
|
||
export interface ButtonAlertModalProps { | ||
modalTitle: string; | ||
modalContentText: string; | ||
name: string; | ||
closeButtonProps: ActionButton; | ||
} | ||
|
||
export const ButtonWithAlertModal = ({ | ||
modalTitle, | ||
modalContentText, | ||
name, | ||
closeButtonProps, | ||
...otherOpenButtonProps | ||
}: ButtonAlertModalProps) => { | ||
return ( | ||
<ButtonWithModal | ||
modalTitle={modalTitle} | ||
modalContentText={modalContentText} | ||
name={name} | ||
actionButtonList={[closeButtonProps]} | ||
{...otherOpenButtonProps} | ||
/> | ||
); | ||
}; | ||
export { ButtonWithConfirmationModal } from './ButtonWithConfirmationModal'; | ||
export { ButtonWithAlertModal } from './ButtonWithAlertModal'; |
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