const React = require('react');
const PropTypes = require('prop-types');
const classnames = require('classnames');
const styles = require('./styles');
const AddonPrompt = ({ className, id, name, logo, description, types, catalogs, version, transportUrl, official }) => {
return (
0 })}>
{
typeof logo === 'string' && logo.length > 0 ?
:
null
}
{typeof name === 'string' && name.length > 0 ? name : id}
{' '}
{
typeof version === 'string' && version.length > 0 ?
v.{version}
:
null
}
{
typeof description === 'string' && description.length > 0 ?
{description}
:
null
}
{
typeof transportUrl === 'string' && transportUrl.length > 0 ?
URL:
{transportUrl}
:
null
}
{
Array.isArray(types) && types.length > 0 ?
Supported types:
{
types.length === 1 ?
types[0]
:
types.slice(0, -1).join(', ') + ' & ' + types[types.length - 1]
}
:
null
}
{
Array.isArray(catalogs) && catalogs.length > 0 ?
Supported catalogs:
{
catalogs.length === 1 ?
catalogs[0].name
:
catalogs.slice(0, -1).map(({ name }) => name).join(', ') + ' & ' + catalogs[catalogs.length - 1].name
}
:
null
}
{
!official ?
Using third-party add-ons will always be subject to your responsibility and the governing law of the jurisdiction you are located.
:
null
}
);
};
AddonPrompt.propTypes = {
className: PropTypes.string,
id: PropTypes.string,
name: PropTypes.string,
logo: PropTypes.string,
description: PropTypes.string,
types: PropTypes.arrayOf(PropTypes.string),
catalogs: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string
})),
version: PropTypes.string,
transportUrl: PropTypes.string,
official: PropTypes.bool
};
module.exports = AddonPrompt;