fix: button display and revert button component changes
This commit is contained in:
parent
550bc2b7a4
commit
8e83d184ba
2 changed files with 25 additions and 18 deletions
|
|
@ -32,8 +32,8 @@ const styles = {
|
|||
const useStyles = makeStyles(styles)
|
||||
|
||||
const FeatureButton = memo(
|
||||
({ className, Icon, InverseIcon, children, active, ...props }) => {
|
||||
const classes = useStyles({ active })
|
||||
({ className, Icon, InverseIcon, children, ...props }) => {
|
||||
const classes = useStyles()
|
||||
|
||||
const classNames = {
|
||||
[classes.featureButton]: true,
|
||||
|
|
|
|||
|
|
@ -123,8 +123,7 @@ const EditableCard = ({
|
|||
[classes.label1Rejected]: state === OVERRIDE_REJECTED,
|
||||
[classes.label1Accepted]: state === OVERRIDE_AUTHORIZED
|
||||
}
|
||||
const isNotAuthorized =
|
||||
state === OVERRIDE_REJECTED || state === OVERRIDE_PENDING
|
||||
|
||||
const authorized =
|
||||
state === OVERRIDE_PENDING
|
||||
? { label: 'Pending', type: 'neutral' }
|
||||
|
|
@ -208,20 +207,28 @@ const EditableCard = ({
|
|||
Cancel
|
||||
</ActionButton>
|
||||
</div>
|
||||
<ActionButton
|
||||
color="secondary"
|
||||
Icon={isNotAuthorized ? AuthorizeIcon : CancelIcon}
|
||||
InverseIcon={
|
||||
isNotAuthorized
|
||||
? AuthorizeReversedIcon
|
||||
: CancelReversedIcon
|
||||
}
|
||||
type="submit"
|
||||
onClick={
|
||||
isNotAuthorized ? () => authorize() : () => reject()
|
||||
}>
|
||||
{isNotAuthorized ? 'Authorize' : 'Reject'}
|
||||
</ActionButton>
|
||||
{authorized.label !== 'Accepted' && (
|
||||
<div className={classes.button}>
|
||||
<ActionButton
|
||||
color="secondary"
|
||||
Icon={AuthorizeIcon}
|
||||
InverseIcon={AuthorizeReversedIcon}
|
||||
type="submit"
|
||||
onClick={() => authorize()}>
|
||||
{'Authorize'}
|
||||
</ActionButton>
|
||||
</div>
|
||||
)}
|
||||
{authorized.label !== 'Rejected' && (
|
||||
<ActionButton
|
||||
color="secondary"
|
||||
Icon={CancelIcon}
|
||||
InverseIcon={CancelReversedIcon}
|
||||
type="submit"
|
||||
onClick={() => reject()}>
|
||||
{'Reject'}
|
||||
</ActionButton>
|
||||
)}
|
||||
{error && (
|
||||
<ErrorMessage>Failed to save changes</ErrorMessage>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue