{% from "govuk_frontend_jinja/components/summary-list/macro.html" import govukSummaryList %}

{% if not subject_reference %}
  {% set depends_on_html %}
    <form method="post" novalidate>
      {{ form.csrf_token }}
      <button type="submit" class="govuk-button govuk-button--secondary govuk-!-margin-bottom-0">Reference data</button>
    </form>
  {% endset %}
{% endif %}

<h2 class="govuk-heading-m">Condition</h2>
{{
  govukSummaryList({
    "rows": [{
      "key": { "text": "The question" if not component.is_group else "The question group" },
      "value": { "text": interpolate(component.text) },
    }, {
      "key": { "text": "Depends on" },
      "value": { "html": depends_on_html } if not subject_reference else { "text": interpolate(subject_reference.question.text if subject_reference.question else subject_reference.label, with_interpolation_highlighting=True) },
    }],
    "classes": "app-!-border-top-line govuk-!-margin-bottom-8"
  })
}}
