You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
52 lines
1.4 KiB
4 years ago
|
import React from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
|
import classnames from 'classnames'
|
||
|
|
||
|
export default function ActionableMessage ({
|
||
|
message = '',
|
||
4 years ago
|
primaryAction = null,
|
||
|
secondaryAction = null,
|
||
4 years ago
|
className = '',
|
||
|
}) {
|
||
|
return (
|
||
4 years ago
|
<div className={classnames('actionable-message', className)}>
|
||
|
<div className="actionable-message__message">
|
||
|
{message}
|
||
|
</div>
|
||
4 years ago
|
{(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>
|
||
|
)}
|
||
4 years ago
|
</div>
|
||
4 years ago
|
)
|
||
|
}
|
||
|
|
||
|
ActionableMessage.propTypes = {
|
||
|
message: PropTypes.string.isRequired,
|
||
4 years ago
|
primaryAction: PropTypes.shape({
|
||
|
label: PropTypes.string,
|
||
|
onClick: PropTypes.func,
|
||
|
}),
|
||
|
secondaryAction: PropTypes.shape({
|
||
4 years ago
|
label: PropTypes.string,
|
||
|
onClick: PropTypes.func,
|
||
|
}),
|
||
|
className: PropTypes.string,
|
||
|
}
|