AuthorizeRejectButtons: refactor ActionEmblem into a separate component
This commit is contained in:
parent
63394bb1b4
commit
09ed0bccab
1 changed files with 16 additions and 10 deletions
|
@ -52,19 +52,11 @@ const AuthorizeRejectButtons: React.FC<IAuthorizeRejectButtons> = ({ onAuthorize
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 'authorized':
|
case 'authorized':
|
||||||
return (
|
return (
|
||||||
<div className='rounded-full bg-gray-100 px-4 py-2 dark:bg-gray-800'>
|
<ActionEmblem text={<FormattedMessage id='authorize.success' defaultMessage='Approved' />} />
|
||||||
<Text theme='muted' size='sm'>
|
|
||||||
<FormattedMessage id='authorize.success' defaultMessage='Approved' />
|
|
||||||
</Text>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
case 'rejected':
|
case 'rejected':
|
||||||
return (
|
return (
|
||||||
<div className='rounded-full bg-gray-100 px-4 py-2 dark:bg-gray-800'>
|
<ActionEmblem text={<FormattedMessage id='reject.success' defaultMessage='Rejected' />} />
|
||||||
<Text theme='muted' size='sm'>
|
|
||||||
<FormattedMessage id='reject.success' defaultMessage='Rejected' />
|
|
||||||
</Text>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
|
@ -88,6 +80,20 @@ const AuthorizeRejectButtons: React.FC<IAuthorizeRejectButtons> = ({ onAuthorize
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface IActionEmblem {
|
||||||
|
text: React.ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
const ActionEmblem: React.FC<IActionEmblem> = ({ text }) => {
|
||||||
|
return (
|
||||||
|
<div className='rounded-full bg-gray-100 px-4 py-2 dark:bg-gray-800'>
|
||||||
|
<Text theme='muted' size='sm'>
|
||||||
|
{text}
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
interface IAuthorizeRejectButton {
|
interface IAuthorizeRejectButton {
|
||||||
theme: 'primary' | 'danger'
|
theme: 'primary' | 'danger'
|
||||||
icon: string
|
icon: string
|
||||||
|
|
Loading…
Reference in a new issue