1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-18 15:33:21 +01:00
metamask-extension/ui/app/pages/swaps/actionable-message/actionable-message.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
2020-11-03 00:41:28 +01:00
export default function ActionableMessage({
message = '',
primaryAction = null,
secondaryAction = null,
className = '',
}) {
return (
<div className={classnames('actionable-message', className)}>
2020-11-03 00:41:28 +01:00
<div className="actionable-message__message">{message}</div>
{(primaryAction || secondaryAction) && (
<div className="actionable-message__actions">
{primaryAction && (
<div
2020-11-03 00:41:28 +01:00
className={classnames(
'actionable-message__action',
'actionable-message__action--primary',
)}
onClick={primaryAction.onClick}
>
{primaryAction.label}
</div>
)}
{secondaryAction && (
<div
2020-11-03 00:41:28 +01:00
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,
}