<section class="full-width-tag-cloud efl-grey">
    <h2 class="efl-heading-2">Still can&#x27;t find what you were looking for?</h2>
    <div aria-controls="" class="full-width-tag-cloud__inner">
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            community
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            playmaker
        </a>
        <a class="tag" data-is-new=true aria-selected="false" data-type=session data-color=#E12613 href="#">
            talent ID
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            philosophy
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            playmaker
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            ID
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            philosophy
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            community
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            playmaker
        </a>
        <a class="tag" data-is-new=true aria-selected="false" data-type=session data-color=#E12613 href="#">
            talent ID
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            philosophy
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            playmaker
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            talent ID
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            talent ID
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            philosophy
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            community
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            playmaker
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            talent ID
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            philosophy
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=session data-color=#E12613 href="#">
            playmaker
        </a>
        <a class="tag" data-is-new=true aria-selected="false" data-type=session data-color=#E12613 href="#">
            talent ID
        </a>
        <a class="tag" data-is-new=false aria-selected="false" data-type=course data-color=#004F9F href="#">
            philosophy
        </a>
    </div>
    <p data-copy-mobile="Press to identify" data-copy="Rollover to identify" class="full-width-tag-cloud__instruction">Rollover to Identify</p>
    <div aria-label="rollover" aria-labelledby="" class="full-width-tag-cloud__rollover">
        <a data-value=session data-color=#E12613 aria-label="session hover to highlight session tags" href="#">
            <span class="indicator"></span>
            sessions
        </a>
        <a data-value=course data-color=#004F9F aria-label="course hover to highlight course tags" href="#">
            <span class="indicator"></span>
            courses
        </a>
    </div>
</section>

No notes defined.

{
  "title": "Still can't find what you were looking for?",
  "tags": [
    {
      "copy": "community",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "playmaker",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "talent ID",
      "type": "session",
      "isNew": true,
      "color": "#E12613"
    },
    {
      "copy": "philosophy",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "playmaker",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "ID",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "philosophy",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "community",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "playmaker",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "talent ID",
      "type": "session",
      "isNew": true,
      "color": "#E12613"
    },
    {
      "copy": "philosophy",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "playmaker",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "talent ID",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "talent ID",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "philosophy",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "community",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "playmaker",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "talent ID",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "philosophy",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    },
    {
      "copy": "playmaker",
      "type": "session",
      "isNew": false,
      "color": "#E12613"
    },
    {
      "copy": "talent ID",
      "type": "session",
      "isNew": true,
      "color": "#E12613"
    },
    {
      "copy": "philosophy",
      "type": "course",
      "isNew": false,
      "color": "#004F9F"
    }
  ],
  "rollover": true,
  "categories": [
    {
      "copy": "sessions",
      "color": "#E12613",
      "value": "session"
    },
    {
      "copy": "courses",
      "color": "#004F9F",
      "value": "course"
    }
  ],
  "eflGrey": true
}
  • Content:
    /* eslint-disable no-param-reassign */
    export default parentElement => {
      const rolloverCategories = parentElement.querySelectorAll(
        '.full-width-tag-cloud__rollover > *'
      );
      const tags = parentElement.querySelectorAll(
        '.full-width-tag-cloud__inner > *'
      );
      const instruction = parentElement.querySelector(
        '.full-width-tag-cloud__instruction'
      );
    
      // set default tag color
      tags.forEach(tag => {
        tag.style.borderColor = tag.dataset.color;
      });
    
      // global varibale to track state of active category
      let highlightedCategory = null;
      let focused = false;
    
      const resetActiveTags = () => {
        tags.forEach(tag => {
          tag.style.color = null;
          tag.style.backgroundColor = null;
          tag.style.opacity = null;
          // tag.ariaSelected = false;
        });
      };
    
      // set the active highlighted category
      const highlightActiveTags = category => {
        const categoryVal = category.dataset.value;
        const categoryColor = category.dataset.color;
    
        tags.forEach(tag => {
          const tagType = tag.dataset.type;
    
          if (tagType === categoryVal) {
            tag.style.backgroundColor = categoryColor;
            tag.style.color = '#FFF';
            // tag.ariaSelected = true;
          } else {
            tag.style.opacity = 0.2;
          }
        });
      };
    
      rolloverCategories.forEach(categoryElement => {
        const categoryColor = categoryElement.dataset.color;
        const indicator = categoryElement.querySelector('span');
    
        indicator.style.backgroundColor = categoryColor;
    
        // Mobile Event Listener
        const handleMouseLeave = () => {
          resetActiveTags();
          categoryElement.removeEventListener('mouseleave', handleMouseLeave, true);
        };
    
        const handleMouseOver = () => {
          highlightActiveTags(categoryElement);
    
          categoryElement.addEventListener('mouseleave', handleMouseLeave, true);
        };
        // Desktop Event listener
    
        const handleClick = e => {
          e.preventDefault();
          // toggle the active state;
          if (highlightedCategory === e.target.dataset) {
            highlightedCategory = 'null';
            resetActiveTags();
          } else {
            highlightedCategory = e.target.dataset;
            resetActiveTags();
            highlightActiveTags(e.target);
          }
        };
    
        const handleClickOff = e => {
          if (!e.target.closest('.full-width-tag-cloud__rollover')) {
            highlightedCategory = 'null';
            resetActiveTags();
          }
        };
    
        const responsiveChanges = () => {
          // Execute different event listener based on dimensions
          if (window.innerWidth > 820) {
            instruction.textContent = instruction.dataset.copy;
            categoryElement.addEventListener('mouseover', handleMouseOver, true);
            categoryElement.removeEventListener('click', handleClick, true);
            document.removeEventListener('click', handleClickOff, true);
          } else {
            instruction.textContent = instruction.dataset.copyMobile;
            categoryElement.addEventListener('click', handleClick, true);
            document.addEventListener('click', handleClickOff, true);
            categoryElement.removeEventListener('mouseover', handleMouseOver, true);
            categoryElement.removeEventListener(
              'mouseleave',
              handleMouseLeave,
              true
            );
          }
        };
    
        // Keyboard Event Listeners
    
        const handleBlur = () => {
          resetActiveTags();
          categoryElement.removeEventListener('blur', handleBlur, true);
          responsiveChanges();
          focused = false;
        };
    
        const handleFocus = () => {
          highlightActiveTags(categoryElement);
          categoryElement.addEventListener('blur', handleBlur, true);
          focused = true;
        };
    
        categoryElement.addEventListener('blur', handleBlur, true);
        categoryElement.addEventListener('focus', handleFocus, true);
    
        parentElement.addEventListener('mouseover', event => {
          const { target } = event;
    
          tags.forEach(tag => {
            if (tag === target && !focused) {
              tag.style.backgroundColor = tag.dataset.color;
              tag.style.color = '#fff';
              // tag.ariaSelected = true;
            }
          });
        });
    
        parentElement.addEventListener('mouseout', event => {
          const { target } = event;
    
          tags.forEach(tag => {
            if (tag === target && !focused) {
              tag.style.backgroundColor = null;
              tag.style.color = null;
              tag.style.borderColor = tag.dataset.color;
              // tag.ariaSelected = false;
            }
          });
        });
    
        responsiveChanges();
    
        // Calibration for resize, rotating screen
        window.addEventListener('resize', () => {
          // reset the tags state when resizing
          responsiveChanges();
        });
      });
    };
    
  • URL: /components/raw/full-width-tag-cloud/full-width-tag-cloud.js
  • Filesystem Path: src/library/components/full-width-tag-cloud/full-width-tag-cloud.js
  • Size: 4.7 KB
  • Content:
    .full-width-tag-cloud {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 3.2rem 4.6rem;
      &.efl-grey {
        background-color: $grey-light;
      }
      h2 {
        color: $blue;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding-bottom: 3.2rem;
        &::after {
          content: '';
          border-bottom: 0.1rem solid $red;
          padding-top: 2.4rem;
          width: 6.7rem;
          height: auto;
        }
      }
    
      p {
        color: $color-interface-light;
        text-transform: uppercase;
        font-family: $text-font-ef;
        font-style: normal;
        font-weight: 400;
        font-size: 1.6rem;
        line-height: 2rem;
        padding-bottom: 1.2rem;
      }
    
      &__inner {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding-bottom: 4.4rem;
        row-gap: 1.2rem;
        column-gap: 0.8rem;
        max-width: 111rem;
        .tag {
          display: flex;
          align-items: center;
          color: $blue;
          font-family: $text-font-ef;
          font-style: normal;
          font-weight: 400;
          font-size: 1.4rem;
          line-height: 2rem;
          letter-spacing: 0.02em;
          text-transform: uppercase;
          text-decoration: none;
          border-width: 0.1rem;
          border-style: solid;
          padding: 0.8rem 1.2rem;
          border-radius: 2.4rem;
          transition: background-color 0.3s ease-in-out, opacity 0.3s ease-in-out;
    
          &[data-is-new='true'] {
            &[aria-selected='true'] {
              &::before {
                background-color: $white;
                color: $blue-accent;
              }
            }
            &::before {
              content: 'new';
              display: inline-block;
              text-transform: uppercase;
              background-color: $blue-accent;
              transition: background-color 0.3s ease-in-out;
              color: $white;
              border-radius: 0.2rem;
              font-style: normal;
              font-weight: 400;
              font-size: 1.2rem;
              line-height: 2rem;
              letter-spacing: 0.06em;
              padding: 0 0.8rem;
              margin-right: 1rem;
            }
          }
    
          &:hover {
            &::before {
              background-color: white;
              color: $blue-accent;
            }
          }
        }
      }
      &__rollover {
        display: flex;
        justify-content: center;
        gap: 2.3rem 4.6rem;
        flex-wrap: wrap;
        a {
          display: flex;
          align-items: center;
          text-transform: uppercase;
          font-family: $text-font-ef;
          text-decoration: none;
          font-style: normal;
          font-weight: 400;
          font-size: 1.6rem;
          line-height: 2rem;
          color: $blue;
          span {
            content: '';
            display: inline-block;
            width: 1.4rem;
            height: 1.4rem;
            border-radius: 0.2rem;
            background-color: $red;
            margin-right: 1.6rem;
          }
        }
      }
    
      @media screen and (min-width: $mq-medium) {
        padding-top: 7.4rem;
        padding-bottom: 5.6rem;
    
        &__inner {
          row-gap: 1.4rem;
          column-gap: 1rem;
          .tag {
            font-size: 1.6rem;
            letter-spacing: 0.06em;
            padding: 1.6rem 3.2rem;
            border-radius: 5.8rem;
          }
        }
    
        &__rollover {
          & > a:active,
          & > a:hover {
            text-decoration: underline;
          }
        }
      }
    }
    
  • URL: /components/raw/full-width-tag-cloud/full-width-tag-cloud.scss
  • Filesystem Path: src/library/components/full-width-tag-cloud/full-width-tag-cloud.scss
  • Size: 3.2 KB
<section class="full-width-tag-cloud{{#if eflGrey}} efl-grey{{/if}}">
  <h2 class="efl-heading-2">{{title}}</h2>
  <div aria-controls="" class="full-width-tag-cloud__inner">
    {{#each tags}}
      <a class="tag" 
        data-is-new={{isNew}} 
        aria-selected="false" 
        data-type={{type}}
        data-color={{color}}
        href="#">
        {{copy}}
      </a>
    {{/each}}
  </div>
  {{#if rollover}}
  <p data-copy-mobile="Press to identify" data-copy="Rollover to identify" class="full-width-tag-cloud__instruction">Rollover to Identify</p>
  <div aria-label="rollover" aria-labelledby="" class="full-width-tag-cloud__rollover">
    {{#each categories}}
      <a 
      data-value={{value}} 
      data-color={{color}} 
      aria-label="{{value}} hover to highlight {{value}} tags"
      href="#">
        <span class="indicator"></span>
        {{copy}}
      </a>
    {{/each}}
  </div>
  {{/if}}
</section>