<commit_before>module ExpressAdmin
  class PageHeaderComponent < ExpressTemplates::Components::Base
      # if content_for?(:page_header)
      #   .row.page-header
      #     %h1
      #       = yield :page_header
      #     - if content_for?(:page_header_lead)
      #       %p.lead
      #         = yield :page_header_lead

    emits header_wrap: -> {
                h1 {
                  _yield
                }

            },
          lead_wrap: -> {
              p.lead {
                _yield
              }
            },
          header: -> {
            content_for(:page_header)
          },
          lead: -> {
            content_for(:page_header_lead)
          }


    using_logic { |c|
      _o = ''
      if content_for?(:page_header)
        _o << c._wrap_using(:header_wrap, self) {
          eval(c[:header])
        }
      end
      if content_for?(:page_header_lead)
        _o << c._wrap_using(:lead_wrap, self) {
          eval(c[:lead])
        }
      end
      _o.html_safe
    }


  end
end<commit_msg>Use new conditionality feature for page_header_component<commit_after>module ExpressAdmin
  class PageHeaderComponent < ExpressTemplates::Components::Base
    ETC = ExpressTemplates::Components

    class PageHeader < ExpressTemplates::Components::Base
      include ETC::Capabilities::Conditionality

      emits {
              h1 {
                content_for(:page_header)
              }
            }

      only_if -> { content_for?(:page_header) }

    end

    class PageHeaderLead < ExpressTemplates::Components::Base
      include ETC::Capabilities::Conditionality

      emits {
              p.lead {
                content_for(:page_header_lead)
              }
            }

      only_if -> { content_for?(:page_header_lead) }

    end

    emits {
        page_header
        page_header_lead
    }

  end


end
{'fraction_non_alphanumeric': 0.09284951974386339, 'fraction_numerical': 0.0016008537886872999, 'mean_word_length': 1.5337837837837838, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6340976', 'n_tokens_mistral': 568, 'n_tokens_neox': 529, 'n_words': 85}