2018-06-13 14:53:41 -04:00
|
|
|
const classNames = require('classnames');
|
2018-06-13 14:05:20 -04:00
|
|
|
const React = require('react');
|
2018-06-13 14:53:41 -04:00
|
|
|
const PropTypes = require('prop-types');
|
2018-06-22 10:01:12 -04:00
|
|
|
const FormattedMessage = require('react-intl').FormattedMessage;
|
2018-06-13 14:05:20 -04:00
|
|
|
require('./extension-chip.scss');
|
|
|
|
|
2018-06-13 14:53:41 -04:00
|
|
|
const ExtensionChip = props => (
|
|
|
|
<div className={classNames('extension-chip', {'has-status': props.hasStatus})}>
|
2018-06-19 15:58:54 -04:00
|
|
|
{props.iconURI &&
|
|
|
|
<img
|
|
|
|
className="extension-icon"
|
|
|
|
src={props.iconURI}
|
|
|
|
/>
|
|
|
|
}
|
2018-06-13 14:05:20 -04:00
|
|
|
<div className="extension-content">
|
2018-06-22 10:01:12 -04:00
|
|
|
{props.extensionL10n ?
|
|
|
|
<FormattedMessage id={props.extensionL10n} /> :
|
|
|
|
<span>{props.extensionName}</span>
|
|
|
|
}
|
2018-06-13 14:53:41 -04:00
|
|
|
{props.hasStatus && (
|
|
|
|
<div className="extension-status">
|
2018-10-24 09:35:30 -04:00
|
|
|
<FormattedMessage id="project.needsConnection" />
|
2018-06-13 14:53:41 -04:00
|
|
|
</div>
|
|
|
|
)}
|
2019-01-14 15:32:00 -05:00
|
|
|
{props.action && (
|
|
|
|
<a href={props.action.uri}>
|
|
|
|
<div className="extension-action">
|
|
|
|
<FormattedMessage id={props.action.l10nId} />
|
|
|
|
<img src="/svgs/project/r-arrow.svg" />
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
)}
|
2018-06-13 14:05:20 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
2018-06-13 14:53:41 -04:00
|
|
|
ExtensionChip.propTypes = {
|
2019-01-14 15:32:00 -05:00
|
|
|
action: PropTypes.shape({
|
|
|
|
l10nId: PropTypes.string,
|
|
|
|
uri: PropTypes.string
|
|
|
|
}),
|
2018-06-22 10:01:12 -04:00
|
|
|
extensionL10n: PropTypes.string,
|
2018-06-13 14:53:41 -04:00
|
|
|
extensionName: PropTypes.string,
|
2018-06-15 08:47:52 -04:00
|
|
|
hasStatus: PropTypes.bool,
|
2018-06-14 15:10:33 -04:00
|
|
|
iconURI: PropTypes.string
|
2018-06-13 14:53:41 -04:00
|
|
|
};
|
|
|
|
|
2018-06-13 14:05:20 -04:00
|
|
|
module.exports = ExtensionChip;
|