1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 00:28:06 +01:00
metamask-extension/ui/app/pages/swaps/actionable-message/actionable-message.js
Mark Stacey 7f1bbbc9a3
Fix message PropType of ActionableMessage (#9653)
The `message` prop of `ActionableMessage` had a PropType of `string`,
but it was being passed a `node`. This was resulting in a PropType
error in the console on the view quote page.

The PropType has been changed to `node`, and the error is now gone.
2020-10-20 10:36:44 -02:30

52 lines
1.4 KiB
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
export default function ActionableMessage ({
message = '',
primaryAction = null,
secondaryAction = null,
className = '',
}) {
return (
<div className={classnames('actionable-message', className)}>
<div className="actionable-message__message">
{message}
</div>
{(primaryAction || secondaryAction) && (
<div className="actionable-message__actions">
{primaryAction && (
<div
className={classnames('actionable-message__action', 'actionable-message__action--primary')}
onClick={primaryAction.onClick}
>
{primaryAction.label}
</div>
)}
{secondaryAction && (
<div
className={classnames('actionable-message__action', 'actionable-message__action--secondary')}
onClick={secondaryAction.onClick}
>
{secondaryAction.label}
</div>
)}
</div>
)}
</div>
)
}
ActionableMessage.propTypes = {
message: PropTypes.node.isRequired,
primaryAction: PropTypes.shape({
label: PropTypes.string,
onClick: PropTypes.func,
}),
secondaryAction: PropTypes.shape({
label: PropTypes.string,
onClick: PropTypes.func,
}),
className: PropTypes.string,
}