Teaser

Information

Folder
src/components/elements/teaser

Files

Schema
// src/components/elements/teaser/schema.yaml

$schema: http://json-schema.org/draft-07/schema#
$id: /elements/teaser
additionalProperties: false
required:
  - url
  - headline
  - image
properties:
  url:
    type: string
    format: uri-reference
  headline:
    type: string
  copy:
    type: string
  format:
    type: object
    properties:
      label:
        type: string
      url:
        type: string
        format: uri-reference
  image:
    type: string
    format: html
  date:
    type: string
  label:
    type: string
  teaser_type:
    type: string
    enum:
      - small
      - medium
      - landscape
  teaser_variant:
    type: string
    enum:
      - engagement
      - petition
  tenant:
    type: string
  teaser_tenant:
    type: string
  id:
    type: string
    description: The id of the petition, needed for the petition teaser type.
Mocks
// src/components/elements/teaser/mocks.yaml

url: '#url'
headline: Das Netz der Windkraftgegner
copy: >-
  Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher
  Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte
  Industrievertreter, so eine  Greenpeace Recherche.
format:
  url: url
  label: format
image:
  $ref: elements/image#teaser
  $tpl: elements/image
date: Datum
$variants:
  - $name: Landscape
    teaser_type: landscape
    label: Mehr zum Thema lesen
    image:
      $ref: elements/image#teaser-medium
      $tpl: elements/image
  - $name: Landscape visual kids
    teaser_type: landscape
    teaser_tenant: kids
    label: Mehr zum Thema lesen
    image:
      $ref: elements/image#teaser-medium
      $tpl: elements/image
  - $name: Small
    teaser_type: small
  - $name: Kids
    teaser_type: small
    tenant: kids
    format: null
    date: null
  - $name: Visual kids
    teaser_type: small
    teaser_tenant: kids
    format: null
    date: null
  - $name: Engagement
    teaser_variant: engagement
    format: null
    date: null
    label: Petition unterzeichnen
  - $name: Engagement landscape
    teaser_variant: engagement
    teaser_type: landscape
    format: null
    date: null
    label: Petition unterzeichnen
  - $name: Petition
    teaser_variant: petition
    format: null
    date: null
    label: Petition unterzeichnen
    id: '29970'
  - $name: Petition landscape
    teaser_variant: petition
    teaser_type: landscape
    format: null
    date: null
    label: Petition unterzeichnen
    id: '29970'
Template
// src/components/elements/teaser/teaser.html.twig

{% if teaser_tenant == "kids" and tenant != "kids" %}
  {% set tenant = "visualKids" %}
{% endif %}

<article class="Teaser
  {%- if class %} {{ class }}{% endif -%}
  {%- if teaser_type %} Teaser--{{ teaser_type }}{% endif -%}
  {%- if teaser_variant %} Teaser--{{ teaser_variant }}{% endif -%}
  {%- if teaser_variant == "petition" %} js-Teaser--petition{% endif -%}
  {%- if tenant %} Teaser--{{ tenant }}{% endif -%}"
  {%- if teaser_variant == "petition" %} data-id="{{ id }}"{% endif -%}
>
  <div class="Teaser-image">
    {% if material_type %}<span class="Teaser-label u-typo-copy-bold">{{ material_type }}</span>{% endif %}
    {{ image|raw }}
  </div>
  <div class="Teaser-text">
    <div class="Teaser-headlineContainer">
      {% if teaser_variant == "engagement" %}
        <span class="Teaser-engagementLabel u-typo-label-small">Petition</span>
      {% endif %}
      <h3 class="Teaser-headline {% if teaser_type == "small" %}u-typo-headline4-desktop-headline3-mobile{% else %}u-typo-headline3{% endif %}">
        <a href="{{ url }}" class="u-paddedText Tracking--teaserLink Teaser-link">{{ headline }}</a>
      </h3>
    </div>
    <div class="Teaser-content">
      {% if tenant == "visualKids" %}
        {% include "@elements/icon/icon.html.twig" with {
          class: "Teaser-visualKidsLogo",
          name: "logo--kids",
        } only %}
      {% elseif format or date %}
        <ul class="Teaser-metaInfo">
          {% if format %}
            <li class="Teaser-metaItem u-typo-label-small">
              <a href="{{ format.url }}" class="Teaser-formatLink">{{ format.label }}</a>
            </li>
          {% endif %}
          {% if date %}
            <li class="Teaser-metaItem u-typo-copy-small">{{ date }}</li>
          {% endif %}
        </ul>
      {% endif %}
      {% if copy %}
        <p class="Teaser-copy">{{ copy|raw }}</p>
      {% endif %}
      {% if teaser_variant == "petition" %}
        {% include "@elements/progress-bar/progress-bar.html.twig" with {
          class: "js-Teaser-progressBar Teaser-progressBar",
          minimal: true,
        } only %}
      {% endif %}
      {% if not teaser_variant %}
        <span class="Teaser-pseudoLink u-brandLink u-typo-copy-bold">
          <span class="Teaser-pseudoLinkIcons">
            <span class="Teaser-pseudoLinkIcon Teaser-pseudoLinkIcon--default"></span>
            {% include "@elements/icon/icon.html.twig" with {
              name: "chevron",
              class: "Teaser-pseudoLinkIcon Teaser-pseudoLinkIcon--hover"
            } only %}
          </span>
          {% if label %}{{ label }}{% else %}Mehr erfahren{% endif %}
      </span>
      {% else %}
        {% include "@elements/button/button.html.twig" with {
          label: label ? label : "Mehr erfahren",
          class: "Teaser-pseudoButton",
          icon: "edit"
        } only %}
      {% endif %}
    </div>
  </div>
</article>

Variants

default
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

Mehr erfahren
Landscape
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

Mehr zum Thema lesen
Landscape visual kids
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

Mehr zum Thema lesen
Small
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

Mehr erfahren
Kids
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

Mehr erfahren
Visual kids
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

Mehr erfahren
Engagement
Open
Engagement landscape
Open
Petition
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

0
haben unterzeichnet
0%
Petition landscape
Open
Alternative text

Der Ausbau der Windkraft stockt. Nicht nur wegen unglücklicher Windparkanwohner – oft bremsen auch als Bürgerinitiative getarnte Industrievertreter, so eine Greenpeace Recherche.

0
haben unterzeichnet
0%