renderShowMoreCard()

in src/amo/pages/Addon/index.js [262:326]


  renderShowMoreCard() {
    const { addon, i18n } = this.props;

    let title;
    const descriptionProps = {};
    let showAbout = true;

    if (addon) {
      switch (addon.type) {
        case ADDON_TYPE_DICT:
          title = i18n.gettext('About this dictionary');
          break;
        case ADDON_TYPE_EXTENSION:
          title = i18n.gettext('About this extension');
          break;
        case ADDON_TYPE_LANG:
          title = i18n.gettext('About this language pack');
          break;
        case ADDON_TYPE_STATIC_THEME:
          title = i18n.gettext('About this theme');
          break;
        default:
          title = i18n.gettext('About this add-on');
      }

      const description = addon.description ? addon.description : addon.summary;
      showAbout = description !== addon.summary;

      if (!description || !description.length) {
        return null;
      }
      descriptionProps.dangerouslySetInnerHTML = sanitizeUserHTML(description);
    } else {
      title = <LoadingText width={40} />;
      descriptionProps.children = <LoadingText width={100} />;
    }

    const showMoreCardName = 'AddonDescription';

    return showAbout ? (
      <ShowMoreCard
        contentId={addon && addon.id}
        className={showMoreCardName}
        header={title}
        id={showMoreCardName}
        maxHeight={300}
      >
        <div className="AddonDescription-contents" {...descriptionProps} />
        {addon && addon.developer_comments ? (
          /* eslint-disable react/no-danger */
          <div className="Addon-developer-comments">
            <header className="Addon-developer-comments-header">
              {i18n.gettext('Developer comments')}
            </header>
            <div
              className="Addon-developer-comments-contents"
              dangerouslySetInnerHTML={sanitizeUserHTML(
                addon.developer_comments,
              )}
            />
          </div>
        ) : null}
      </ShowMoreCard>
    ) : null;
  }