include composer
include comment-list

mixin renderCommentSection (options = { })
  section
    .uk-container
      if user && user.permissions.canComment
        -
          const composerOptions = Object.assign({ }, options);
          composerOptions.name = `${options.name}-composer`;
        .content-block(dtp-comments= composerOptions.name, data-root-url= options.rootUrl)
          .uk-margin
            +renderSectionTitle('Add a comment')
          .uk-margin-small
            +renderCommentComposer(composerOptions.name, composerOptions)

      if featuredComment
        .content-block(dtp-comments= `${options.name}-feature`, data-root-url= options.rootUrl)
          #featured-comment.uk-margin-large
            .uk-margin
              +renderSectionTitle('Linked Comment')
            -
              const featureOptions = Object.assign({ }, options);
              featureOptions.name = `${options.name}-feature`;
            +renderComment(featuredComment, featureOptions)

      .content-block(dtp-comments= options.name, data-root-url= options.rootUrl)
        +renderSectionTitle('Comments')

        if Array.isArray(comments) && (comments.length > 0)
          ul#post-comment-list.uk-list.uk-list-divider.uk-list-large
            +renderCommentList(comments, Object.assign({
              countPerPage: countPerPage || 10,
              rootUrl: options.rootUrl,
            }, options))
        else
          ul#post-comment-list.uk-list.uk-list-divider.uk-list-large
          div There are no comments at this time. Please check back later.