{% set paragraph_tag = (content.field_header.0) ? 'section' : 'div' %}

{% if not paragraph.isPublished() %}
  {% set attributes = attributes.setAttribute('data-unpublished', 'paragraph') %}
{% endif %}

{% if content.field_header or not paragraph.isPublished() %}
  <{{ paragraph_tag }}{{ attributes }}>
{% endif %}

  {{ content.field_header }}

  {{ content.field_view }}

{% if content.field_header or not paragraph.isPublished() %}
  </{{ paragraph_tag }}>
{% endif %}
