Use l10n ids in extension chip

This commit is contained in:
Connor Hudson 2018-06-22 10:01:12 -04:00
parent af1cf6bf6e
commit 80dfaa6a1e
2 changed files with 8 additions and 2 deletions

View file

@ -1,6 +1,7 @@
const classNames = require('classnames'); const classNames = require('classnames');
const React = require('react'); const React = require('react');
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
const FormattedMessage = require('react-intl').FormattedMessage;
require('./extension-chip.scss'); require('./extension-chip.scss');
const ExtensionChip = props => ( const ExtensionChip = props => (
@ -12,7 +13,10 @@ const ExtensionChip = props => (
/> />
} }
<div className="extension-content"> <div className="extension-content">
{props.extensionL10n ?
<FormattedMessage id={props.extensionL10n} /> :
<span>{props.extensionName}</span> <span>{props.extensionName}</span>
}
{props.hasStatus && ( {props.hasStatus && (
<div className="extension-status"> <div className="extension-status">
Needs Connection Needs Connection
@ -23,6 +27,7 @@ const ExtensionChip = props => (
); );
ExtensionChip.propTypes = { ExtensionChip.propTypes = {
extensionL10n: PropTypes.string,
extensionName: PropTypes.string, extensionName: PropTypes.string,
hasStatus: PropTypes.bool, hasStatus: PropTypes.bool,
iconURI: PropTypes.string iconURI: PropTypes.string

View file

@ -268,10 +268,11 @@ const PreviewPresentation = ({
<FlexRow className="extension-list"> <FlexRow className="extension-list">
{extensions && extensions.map(extension => ( {extensions && extensions.map(extension => (
<ExtensionChip <ExtensionChip
extensionL10n={extension.l10nId}
extensionName={extension.name} extensionName={extension.name}
hasStatus={extension.hasStatus} hasStatus={extension.hasStatus}
iconURI={extension.icon && `/svgs/project/${extension.icon}`} iconURI={extension.icon && `/svgs/project/${extension.icon}`}
key={extension.name} key={extension.name || extension.l10nId}
/> />
))} ))}
</FlexRow> </FlexRow>