stefbowerman / cadaver-2.0

11 stars 0 forks source link

Graphic cover video should use image prop as poster image if available #34

Closed stefbowerman closed 4 months ago

stefbowerman commented 5 months ago
{%- comment %}

  Graphic Cover
  ------------------------------------------------------------------------------

  Usage:

  {% render 'graphic-cover',
             image: { image } - optional
             image_mobile: { image } - optional
             video: { video } - optional
             loading: { string } - optional
  %}

{% endcomment -%}

<div class="graphic-cover" data-graphic-cover>
  {% if video != nil %}
    {% if image != blank %}
      {% assign poster = image | image_url: width: 1600 %}
      {{ video | video_tag: muted: true, playsinline: true, autoplay: true, loop: true, class: 'ambient-video', image_size: '1600x', poster: poster }}
    {% else %}
      {{ video | video_tag: muted: true, playsinline: true, autoplay: true, loop: true, class: 'ambient-video', image_size: '1600x' }}
    {% endif %}
  {% endif %}

  {% if image != blank %}
    {% render 'image-responsive'
              image: image,
              image_mobile: image_mobile,
              loading: loading
    %}
  {% endif %}
</div>
stefbowerman commented 4 months ago

Closed with b591f36