Skip to content
Snippets Groups Projects
Verified Commit 9d0913c2 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3365497 by finnsky, Gauravvvv, sarahjean, smustgrave, snig, e0ipso,...

Issue #3365497 by finnsky, Gauravvvv, sarahjean, smustgrave, snig, e0ipso, pdureau: Create new SDC component for Umami Banner

(cherry picked from commit ff392533)
parent bed76898
No related branches found
No related tags found
26 merge requests!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!7078Issue #3320569 by Spokje, mondrake, smustgrave, longwave, quietone, Lendude,...,!6622Issue #2559833 by piggito, mohit_aghera, larowlan, guptahemant, vakulrai,...,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #107382 passed with warnings
Pipeline: drupal

#107394

    Pipeline: drupal

    #107386

      # This is so your IDE knows about the syntax for fixes and autocomplete.
      $schema: https://git.drupalcode.org/project/drupal/-/raw/10.1.x/core/modules/sdc/src/metadata.schema.json
      # The human readable name.
      name: Banner
      # Status can be: "experimental", "stable", "deprecated", "obsolete".
      status: experimental
      props:
      # Props are always an object with keys. Each key is a variable in your
      # component template.
      type: object
      properties:
      attributes:
      type: Drupal\Core\Template\Attribute
      title: Attributes
      description: Banner attributes.
      # Slots always hold arbitrary markup. We know that beforehand, so no need for
      # a schema for slots.
      slots:
      # The key is the name of the slot. In your template you will use
      # {% block content %}.
      content:
      # A human-readable name.
      title: Content
      # A description.
      description: This is the banner content
      image:
      # A human-readable name.
      title: Image
      # A description.
      description: This is the banner image
      ......@@ -3,12 +3,12 @@
      * This file is used to style the banner block.
      */
      .banner-block__content {
      .banner__content {
      margin: 1rem 4%;
      font-size: 1.188em;
      }
      .banner-block .field--name-field-title {
      .banner__title {
      margin: 0 0 0.5em 0;
      font-family: "Scope One", Georgia, serif;
      font-size: 1.777em;
      ......@@ -16,38 +16,14 @@
      line-height: 1.2em;
      }
      .banner-block .field--name-field-content-link a {
      display: inline-block;
      padding: 0.7em 1.3em;
      cursor: pointer;
      transition: background-color 0.5s ease;
      text-align: center;
      text-decoration: none;
      color: #fff;
      border: 2px solid #d93760;
      border-radius: 3px;
      background-color: #d93760;
      font-family: "Scope One", Georgia, serif;
      font-size: 1.2rem;
      font-weight: 400;
      }
      .banner-block .field--name-field-content-link a:focus,
      .banner-block .field--name-field-content-link a:hover {
      color: #000;
      border-color: #d93760;
      outline-color: #fff;
      outline-offset: 2px;
      background-color: #fcece7;
      }
      /* Medium */
      @media screen and (min-width: 48rem) { /* 768px */
      .banner-block {
      .banner {
      position: relative; /* Anchor absolutely positioned background image. */
      background-color: #464646;
      }
      .banner-block__inner {
      .banner__inner {
      display: flex;
      align-items: center;
      min-height: 54vw;
      ......@@ -55,7 +31,7 @@
      padding: 0 4%;
      }
      .banner-block__content {
      .banner__content {
      position: relative; /* Establish stacking context to appear above absolutely positioned background image. */
      max-width: 50%;
      margin: 0;
      ......@@ -65,7 +41,7 @@
      background: rgba(0, 0, 0, 0.42);
      }
      .banner-block__image img {
      .banner__image img {
      position: absolute;
      top: 0;
      left: 0;
      ......@@ -76,16 +52,16 @@
      }
      /* Large */
      @media screen and (min-width: 60rem) { /* 960px */
      .banner-block__content {
      .banner__content {
      max-width: 41%;
      }
      .banner-block__inner {
      .banner__inner {
      min-height: 43vw;
      }
      }
      /* Extra large + side margins */
      @media screen and (min-width: 80rem) { /* 1200px (large) + 80px (side margins) = 1280px */
      .banner-block__inner {
      .banner__inner {
      padding: 0;
      }
      }
      <div{{ attributes.addClass('banner') }}>
      <div class="container">
      <div class="banner__inner">
      <div class="banner__image">
      {% block image %}{% endblock %}
      </div>
      <div class="banner__content">
      {% block content %}{% endblock %}
      </div>
      </div>
      </div>
      </div>
      ......@@ -30,6 +30,19 @@
      background-color: #e6eee0;
      }
      .button--primary {
      border-color: #d93760;
      background-color: #d93760;
      }
      .button--primary:hover,
      .button--primary:active,
      .button--primary:focus {
      outline-color: #fff;
      outline-offset: 2px;
      background-color: #fcece7;
      }
      .button[disabled]:hover,
      .button[disabled]:active,
      .button[disabled]:focus,
      ......
      {% extends "block.html.twig" %}
      {#
      /**
      * @file
      ......@@ -26,31 +27,19 @@
      * @see template_preprocess_block()
      */
      #}
      {%
      set classes = [
      'banner-block',
      'block',
      'block-' ~ configuration.provider|clean_class,
      'block-' ~ plugin_id|clean_class,
      ]
      %}
      <div{{ attributes.addClass(classes) }}>
      <div class="container">
      <div class="banner-block__inner">
      {{ title_prefix }}
      {% if label %}
      <h2{{ title_attributes }}>{{ label }}</h2>
      {% endif %}
      {{ title_suffix }}
      {% block content %}
      <div class="banner-block__image">
      {{ content.field_media_image }}
      </div>
      <div class="banner-block__content">
      {{ content|without('field_media_image') }}
      </div>
      {% endblock %}
      </div>
      </div>
      </div>
      {% block content %}
      {% embed 'umami:banner' with {
      attributes: create_attribute(),
      } %}
      {% block image %}
      {{ content.field_media_image }}
      {% endblock %}
      {% block content %}
      {% include "umami:title" with {
      attributes: create_attribute({'class': ['banner__title']}),
      label: content.field_title,
      } only %}
      {{ content|without(['field_media_image', 'field_title']) }}
      {% endblock %}
      {% endembed %}
      {% endblock %}
      ......@@ -4,7 +4,6 @@ global:
      base:
      css/base.css: {}
      component:
      css/components/blocks/banner/banner.css: {}
      css/components/blocks/help/help.css: {}
      css/components/blocks/page-title/page-title.css: {}
      css/components/blocks/language-switcher/language-switcher.css: {}
      ......
      ......@@ -69,6 +69,19 @@ function umami_theme_suggestions_block_alter(array &$suggestions, array $variabl
      }
      }
      /**
      * Implements hook_umami_preprocess_block__bundle__banner_block().
      */
      function umami_preprocess_block__bundle__banner_block(&$variables) {
      if (isset($variables['content']['field_content_link'])) {
      foreach (Element::children($variables['content']['field_content_link']) as $key) {
      $variables['content']['field_content_link'][$key]['#attributes']['class'][] = 'button';
      $variables['content']['field_content_link'][$key]['#attributes']['class'][] = 'button--primary';
      $variables['content']['field_content_link'][$key]['#attributes']['class'][] = 'banner__button';
      }
      }
      }
      /**
      * Implements hook_umami_preprocess_block__bundle__footer_promo_block().
      */
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Finish editing this message first!
      Please register or to comment