Web Design Guide 2023-12-11 10:29:21 | 2.0.0

Gallery

<div class="gallery">
    <div class="gallery__list">
        <div class="gallery__item -active">
            <div class=" captioned-image ">
                <div class=" media ">
                    <img class="media__item" src="/demo/teaser/teaser6.jpg" alt=>
                </div>

                <div class="captioned-image__caption ">
                    RAUTOOL A-light2 Kombi mit 3-fach Jochsatz
                </div>
            </div>

        </div>
        <div class="gallery__item ">
            <div class=" captioned-image ">
                <div class=" media ">
                    <img class="media__item" src="/demo/teaser/teaser6.jpg" alt=>
                </div>

                <div class="captioned-image__caption ">
                    RAUTOOL A-light2 Kombi mit 3-fach Jochsatz
                </div>
            </div>

        </div>
        <div class="gallery__item ">
            <div class=" captioned-image ">
                <div class=" media ">
                    <img class="media__item" src="/demo/teaser/teaser6.jpg" alt=>
                </div>

                <div class="captioned-image__caption ">
                    RAUTOOL A-light2 Kombi mit 3-fach Jochsatz
                </div>
            </div>

        </div>
        <div class="gallery__controls -ar-7x5">
            <a class="gallery__prev" href="#"></a>
            <a class="gallery__next" href="#"></a>
        </div>
        <ul class="gallery__indicators">
            <li class="gallery__indicator -active"></li>
            <li class="gallery__indicator "></li>
            <li class="gallery__indicator "></li>
        </ul>
    </div>
</div>
<div class="gallery">
  <div class="gallery__list">
    {{#each items}}
      <div class="gallery__item {{modifiers}}">
        {{render '@molecules-captioned-image' image}}
      </div>
    {{/each}}
    <div class="gallery__controls -ar-7x5">
      <a class="gallery__prev" href="#"></a>
      <a class="gallery__next" href="#"></a>
    </div>
    <ul class="gallery__indicators">
      {{#each items}}
        <li class="gallery__indicator {{modifiers}}"></li>
      {{/each}}
    </ul>
  </div>
</div>
{
  "items": [
    {
      "modifiers": "-active",
      "captionedImage": {
        "image": {
          "src": "/demo/teaser/teaser1.jpg"
        },
        "caption": "Elektro-/Akku-hydraulisches Schiebehulsenwerkzeug RAUTOOL G2"
      }
    },
    {
      "captionedImage": {
        "image": {
          "src": "/demo/teaser/teaser2.jpg"
        },
        "caption": "RAUTOOL K-Werkzeug"
      }
    },
    {
      "captionedImage": {
        "image": {
          "src": "/demo/teaser/teaser3.jpg"
        },
        "caption": "Hydraulisch-mechanisch betriebenes Schiebehülsenwerkzeug für die Abmessung 50 bis 63 mm bzw. 40 bis 110 mm"
      }
    }
  ]
}
  • Content:
    $gallery-chooser-icon-size: 20px !default;
    
    .gallery {
      $root: &;
      $icon-font-size: 3.2rem;
      $icon-margin-size: 0.8rem;
    
      &__list {
        position: relative;
      }
    
      &__item {
        display: none;
    
        &.-active {
          display: block;
          animation: gallery-image-blink 0.4s linear;
        }
      }
    
      &__indicators,
      &__indicators__slider {
        display: flex;
        flex-flow: row nowrap;
        justify-content: center;
        padding: 1.6rem 0;
      }
    
      &__indicator,
      &__indicator__slider {
        position: relative;
        flex: 0 1 4rem;
        height: 0.4rem;
        background-color: $gray-lighter;
        list-style-type: none;
    
        &::before,
        &::after {
          content: '';
          position: absolute;
          left: 0;
          display: inline-block;
          width: 100%;
          height: 0.8rem;
        }
    
        &::before {
          top: -0.8rem;
        }
    
        &::after {
          bottom: -0.8rem;
        }
    
        &:hover,
        &:focus {
          background-color: $gray;
          cursor: pointer;
        }
    
        &.-active {
          background-color: $primary;
        }
      }
    
      &__controls {
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        height: 100%;
        pointer-events: none;
    
        #{$root}__prev,
        #{$root}__next,
        #{$root}__zoom {
          text-decoration: none;
        }
      }
    
      &__prev,
      &__next,
      &__zoom {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 10%;
        color: $gray-light;
        pointer-events: auto;
    
        &::before {
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
          font-size: $icon-font-size;
        }
    
        @at-root {
          .-desktop &:hover {
            color: $primary;
          }
    
          [class*='-cs-'] {
            #{$root}__prev,
            #{$root}__next,
            #{$root}__zoom {
              color: $gray-light;
            }
          }
        }
    
        &:active {
          color: $primary;
        }
      }
    
      &__next {
        right: 0;
    
        &::before {
          $symbol-next: map-get($icons, 'chevron-right');
          @include icon-content-extended($symbol-next);
    
          right: $icon-margin-size;
        }
      }
    
      &__prev {
        left: 0;
    
        &::before {
          $symbol-prev: map-get($icons, 'chevron-left');
          @include icon-content-extended($symbol-prev);
          left: $icon-margin-size;
        }
      }
    
      &__zoom {
        @include breakpoint(medium) {
          right: 0;
          left: 0;
          width: 100%;
    
          &::before {
            $symbol-zoom: map-get($icons, 'search');
            @include icon-content-extended($symbol-zoom);
            top: auto;
            right: $icon-margin-size;
            bottom: $icon-margin-size;
            transform: none;
          }
    
          ~ .gallery__next {
            bottom: $icon-font-size + 2 * $icon-margin-size;
    
            &::before {
              transform: translateY($icon-font-size / 2 + $icon-margin-size) translateY(-50%);
            }
          }
        }
      }
    
      &.-lightboxed {
        $height-paddings: 4rem;
        $width-paddings: 3.2rem;
        $aspect-ratio: map-get($aspect-ratios, $base-aspect-ratio);
        $aspect-ratio-value: aspect-ratio-value($aspect-ratio);
    
        @include height-by-aspect-ratio(
          $aspect-ratio,
          $height-paddings,
          $width-paddings,
          -3.6rem
        ); //-3.6rem because of gallery indicators size
    
        position: relative;
        margin: auto;
    
        .gallery {
          &__zoom {
            display: none;
          }
    
          &__next {
            bottom: 0;
    
            &::before {
              transform: translateY(-50%);
            }
          }
    
          &__indicators {
            margin-bottom: 0;
          }
        }
      }
    
      @at-root .-desktop &--mobile-only {
        #{$root}__item {
          display: block;
        }
    
        #{$root}__controls,
        #{$root}__indicators {
          display: none;
        }
      }
    
      @at-root .-mobile &--mobile-only {
        @include breakpoint(pre-medium down) {
          .grid-margin-y {
            + #{$root}__controls {
              @each $breakpoint, $gutter in $grid-gutters {
                @include breakpoint($breakpoint) {
                  top: rem-calc($gutter / 2);
                }
              }
            }
    
            &.-halve + #{$root}__controls {
              @each $breakpoint, $gutter in $grid-gutters {
                @include breakpoint($breakpoint) {
                  top: rem-calc($gutter / 4);
                }
              }
            }
          }
    
          #{$root}__item.-active {
            ~ .cell > .grid-x {
              display: none;
            }
          }
        }
    
        @include breakpoint(medium) {
          #{$root}__item {
            display: block;
          }
    
          #{$root}__controls,
          #{$root}__indicators {
            display: none;
          }
        }
      }
    
      &__slide {
        &__controls {
          float: right;
          width: 40%;
        }
    
        &__chooser {
          display: inline-block;
          width: $gallery-chooser-icon-size;
          height: $gallery-chooser-icon-size;
          margin-right: 0.5em;
          padding: 0;
          padding-right: 1em;
          border: 2px solid $black;
          border-radius: 50%;
          background-color: $white;
          font-size: ($gallery-chooser-icon-size - 4px);
          cursor: pointer;
    
          &:hover,
          &:focus,
          &.-active {
            border-color: $primary;
          }
        }
    
        &__variant {
          display: none;
    
          &.-active {
            display: block;
          }
    
          &__title {
            width: 60%;
            margin-bottom: 0;
          }
        }
      }
    }
    
    @keyframes gallery-image-blink {
      0% {
        opacity: 0;
      }
    
      100% {
        opacity: 1;
      }
    }
    
  • URL: /components/raw/molecules-gallery/_gallery.scss
  • Filesystem Path: src/components/02-ui-components/02-molecules/14-gallery/_gallery.scss
  • Size: 5.2 KB

There are no notes for this item.