<section class="progressive-profile inline-component" data-behavior="progressive-profile" data-fanid="111">
    <div class="progressive-profile__wrapper">
        <picture>
            <source media="(max-width: 819px)" srcset="/assets/example-content/progressive-profile-bg-mob.jpg">
            <source media="(min-width: 820px)" srcset="/assets/example-content/progressive-profile-bg-desk.jpg">
            <img src="/assets/example-content/progressive-profile-bg-desk.jpg" class="promo-background" alt="">
        </picture>

        <div class="progressive-profile__overlay">
            <div class="progressive-profile__overlay--wrapper">
                <img src="/assets/example-content/efl-logo-shield-white.svg" alt="">
                <h2 data-inprogress-title="Continue editing to personalise your learning experience" data-completed-title="Your preferences have been saved!">Personalise your site!
                </h2>
                <p data-edit-copy="You can change your preferences by clicking on the &#x27;Edit Preferences&#x27; button below.">Help us surface more relevant content to you each time you visit the site.</p>
                <button class="cta cta--efl  " id="edit-profile-preference" data-edit-cta="EDIT preferences" aria-label="start now to personalize your preferences">Start Now</button>
            </div>
        </div>
        <div class="progressive-profile__questions" role="dialog" aria-modal="true">
            <div class="progressive-profile__questions--container">
                <progress value="1" class="progress-bar-line"></progress>
                <button class="close-btn" tabindex="-1" aria-label="close the profile preferences">
                    <span class="visually-hidden">Close dialog</span>
                </button>
                <div class="progressive-profile__questions--list">
                    <div class="all-questions">
                        <div class="all-questions__single" data-questions-type="FootballGender">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        What is your gender?</div>
                                    <p class="info">Choose any one as you like</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    <ul class="all-questions__single--options">
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-1" type="radio" class="single-answer" id="ans-1-option-1" value="Male" tabindex="-1">
                                            <label for="ans-1-option-1">Male</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-1" type="radio" class="single-answer" id="ans-1-option-2" value="Female" tabindex="-1">
                                            <label for="ans-1-option-2">Female</label>
                                        </div>
                                    </ul>
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true" aria-label="next preference" data-cta-text="Next">Next</button>
                            </div>
                        </div>
                        <div class="all-questions__single" data-questions-type="FootballDisciplines">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        What is your disciplines?</div>
                                    <p class="info">Choose as many as you like</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    <ul class="all-questions__single--options">
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-2" type="checkbox" class="multi-answer" id="ans-2-option-1" value="Receiving the Ball" tabindex="-1">
                                            <label for="ans-2-option-1">Receiving the Ball</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-2" type="checkbox" class="multi-answer" id="ans-2-option-2" value="Finishing" tabindex="-1">
                                            <label for="ans-2-option-2">Finishing</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-2" type="checkbox" class="multi-answer" id="ans-2-option-3" value="Moving with the Ball" tabindex="-1">
                                            <label for="ans-2-option-3">Moving with the Ball</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-2" type="checkbox" class="multi-answer" id="ans-2-option-4" value="Turning" tabindex="-1">
                                            <label for="ans-2-option-4">Turning</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-2" type="checkbox" class="multi-answer" id="ans-2-option-5" value="Passing" tabindex="-1">
                                            <label for="ans-2-option-5">Passing</label>
                                        </div>
                                    </ul>
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true" aria-label="next preference" data-cta-text="Next">Next</button>
                            </div>
                        </div>
                        <div class="all-questions__single" data-questions-type="FootballType">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        What is your football type?</div>
                                    <p class="info">Choose as many as you like</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    <ul class="all-questions__single--options">
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-1" type="checkbox" class="multi-answer" id="ans-3-option-1" value="FootballType 1" tabindex="-1">
                                            <label for="ans-3-option-1">FootballType 1</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-2" type="checkbox" class="multi-answer" id="ans-3-option-2" value="FootballType 2" tabindex="-1">
                                            <label for="ans-3-option-2">FootballType 2</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-3" type="checkbox" class="multi-answer" id="ans-3-option-3" value="FootballType 3" tabindex="-1">
                                            <label for="ans-3-option-3">FootballType 3</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-4" type="checkbox" class="multi-answer" id="ans-3-option-4" value="FootballType 4" tabindex="-1">
                                            <label for="ans-3-option-4">FootballType 4</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            <input name="question-5" type="checkbox" class="multi-answer" id="ans-3-option-5" value="FootballType 5" tabindex="-1">
                                            <label for="ans-3-option-5">FootballType 5</label>
                                        </div>
                                    </ul>
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true" aria-label="next preference" data-cta-text="Next">Next</button>
                            </div>
                        </div>
                        <div class="progressive-profile__sign-in benefits">
                            <div class="progressive-profile__sign-in--inner benefits">
                                <div class="progressive-profile__sign-in__content thanks-screen">
                                    <h2>Thanks, Edwin Jebaraj</h2>
                                    <p>We have saved your preferences, and we will be using this information to curate
                                        content that is specifically tailored
                                        to your interests and needs.
                                    </p>
                                    <br>
                                    <p>Now is the perfect time to get started with our articles
                                        and sessions that are tailored to your profile.</p>
                                    <br>
                                    <p>You can change your preferences in future here <strong style="text-decoration: underline;"><a class="change-preferences-again">here</a></strong></p>

                                </div>
                                <div class="progressive-profile__sign-in__cards">
                                    <a href="#" class="efl-carousel-card " aria-label="BT Playmaker by England Football">
                                        <img class="efl-carousel-card--image" src="/assets/example-content/image-singpost-1.png" alt="">
                                        <div class="efl-carousel-card__content">
                                            <p class="efl-carousel-card__content--category">course</p>
                                            <h4 class="efl-carousel-card__content--title">BT Playmaker by England Football</h4>
                                        </div>
                                    </a>
                                    <a href="#" class="efl-carousel-card " aria-label="BT Playmaker by England Football">
                                        <img class="efl-carousel-card--image" src="/assets/example-content/image-singpost-1.png" alt="">
                                        <div class="efl-carousel-card__content">
                                            <p class="efl-carousel-card__content--category">course</p>
                                            <h4 class="efl-carousel-card__content--title">BT Playmaker by England Football</h4>
                                        </div>
                                    </a>
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="false" class="previous" aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                            </div>
                        </div>
                        <div class="progressive-profile__sign-in">
                            <div class="progressive-profile__sign-in--inner">
                                <div class="progressive-profile__sign-in__content">
                                    <h3>In order to personalise your experience, please sign up or sign in so we can
                                        save your prefrences</h3>
                                    <p>Benefits of creating your own personalised experience</p>
                                    <p>We will tailor your site content moving forward.</p>
                                    <ul>
                                        <li>Content you care about</li>
                                        <li>Sessions tailored to your team</li>
                                        <li>Course information and alerts</li>
                                    </ul>
                                </div>
                                <div class="progressive-profile__sign-in__registration">
                                    <div class="progressive-profile__sign-in__registration--links">
                                        <a href="/" class="cta cta--efl  sign-up-cta" tabindex="0">Sign Up</a>

                                        <a href="/" class="cta cta--efl  sign-in-cta" tabindex="0">Sign In</a>

                                    </div>
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="false" class="previous signin-signup-prev" aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

No notes defined.

{
  "smallimage": "/assets/example-content/progressive-profile-bg-mob.jpg",
  "bigimage": "/assets/example-content/progressive-profile-bg-desk.jpg",
  "title": "Personalise your site!",
  "completed-title": "Your preferences have been saved!",
  "inprogress-title": "Continue editing to personalise your learning experience",
  "copy": "Help us surface more relevant content to you each time you visit the site.",
  "edited-copy": "You can change your preferences by clicking on the 'Edit Preferences' button below.",
  "questionsEnabled": true,
  "userName": "Edwin Jebaraj",
  "edit-preference-cta": {
    "copy": "EDIT preferences",
    "modifier": "efl",
    "id": "edit-profile-preference",
    "href": ""
  },
  "next-cta": {
    "copy": "Next",
    "modifier": "efl",
    "additionalClass": "personalisationNext",
    "id": "next-cta",
    "href": ""
  },
  "sign-up-cta": {
    "copy": "Sign Up",
    "additionalClass": "sign-up-cta"
  },
  "sign-in-cta": {
    "copy": "Sign In",
    "additionalClass": "sign-in-cta"
  },
  "questions-list": [
    {
      "number": 1,
      "question": "What is your gender?",
      "question-type": "FootballGender",
      "info": "This will help us surface more relevant content to you each time you visit the site",
      "answers": [
        {
          "name": "question-1",
          "value": "Male",
          "id": "ans-1-option-1"
        },
        {
          "name": "question-1",
          "value": "Female",
          "id": "ans-1-option-2"
        }
      ],
      "multi-answer": false,
      "answer-tip": "Choose any one as you like"
    },
    {
      "number": 2,
      "question": "What is your disciplines?",
      "question-type": "FootballDisciplines",
      "info": "This will help us surface more relevant content to you each time you visit the site",
      "answers": [
        {
          "name": "question-2",
          "value": "Receiving the Ball",
          "id": "ans-2-option-1"
        },
        {
          "name": "question-2",
          "value": "Finishing",
          "id": "ans-2-option-2"
        },
        {
          "name": "question-2",
          "value": "Moving with the Ball",
          "id": "ans-2-option-3"
        },
        {
          "name": "question-2",
          "value": "Turning",
          "id": "ans-2-option-4"
        },
        {
          "name": "question-2",
          "value": "Passing",
          "id": "ans-2-option-5"
        }
      ],
      "multi-answer": true,
      "answer-tip": "Choose as many as you like"
    },
    {
      "number": 3,
      "question": "What is your football type?",
      "question-type": "FootballType",
      "info": "This will help us surface more relevant content to you each time you visit the site",
      "answers": [
        {
          "name": "question-1",
          "value": "FootballType 1",
          "id": "ans-3-option-1"
        },
        {
          "name": "question-2",
          "value": "FootballType 2",
          "id": "ans-3-option-2"
        },
        {
          "name": "question-3",
          "value": "FootballType 3",
          "id": "ans-3-option-3"
        },
        {
          "name": "question-4",
          "value": "FootballType 4",
          "id": "ans-3-option-4"
        },
        {
          "name": "question-5",
          "value": "FootballType 5",
          "id": "ans-3-option-5"
        }
      ],
      "multi-answer": true,
      "answer-tip": "Choose as many as you like"
    }
  ],
  "modifier": "inline-component"
}
  • Content:
    import { gsap } from 'gsap';
    
    export default parentElement => {
      // const MOBILE_BREAKPOINT = 820;
      const editPreference = parentElement.querySelector(
        '#edit-profile-preference'
      );
      const { editCta } = editPreference.dataset;
      const closeBtns = parentElement.querySelector(
        '.progressive-profile__questions--container .close-btn'
      );
      const wrapper = parentElement.querySelector('.progressive-profile__wrapper');
      const bannerOverlay = parentElement.querySelector(
        '.progressive-profile__overlay'
      );
      const questionsList = parentElement.querySelector(
        '.progressive-profile__questions--list'
      );
      const progressBar = parentElement.querySelector('.progress-bar-line');
      const signIn = parentElement.querySelector(
        '.progressive-profile__sign-in:not(.benefits)'
      );
      const successDiv = parentElement.querySelector(
        '.progressive-profile__sign-in.benefits'
      );
      const questionsContainer = parentElement.querySelector('.all-questions');
      const allQuestionsItem = parentElement.querySelectorAll('.all-questions > *');
      const questions = parentElement.querySelectorAll('.all-questions__single');
      const { fanid } = parentElement.dataset;
    
      const navigation = parentElement.querySelector(
        '.progressive-profile__questions--list__navigation'
      );
      const signinSignupPrev = parentElement.querySelector('.signin-signup-prev');
      const { inprogressTitle, completedTitle } = bannerOverlay.querySelector(
        'h2'
      ).dataset;
      const { editCopy } = bannerOverlay.querySelector('p').dataset;
      let answeredQuestions = 0;
    
      // Accessibility
      const updateTabIndex = activeItem => {
        allQuestionsItem.forEach(item => {
          const allInputs = item.querySelectorAll('input, a, button');
    
          allInputs.forEach(element => {
            // eslint-disable-next-line no-param-reassign
            element.tabIndex = '-1';
            if (element.type === 'checkbox') {
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '-1';
            } else if (element.type === 'radio') {
              // eslint-disable-next-line no-param-reassign
              element.nextElementSibling.tabIndex = '-1';
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '-1';
            }
          });
        });
    
        if (activeItem) {
          const activeItemEle = activeItem.querySelectorAll('input, a, button');
    
          activeItemEle.forEach(element => {
            // eslint-disable-next-line no-param-reassign
            element.tabIndex = '0';
            if (element.type === 'checkbox') {
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '0';
            } else if (element.type === 'radio') {
              // eslint-disable-next-line no-param-reassign
              element.nextElementSibling.tabIndex = '0';
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '-1';
            }
          });
        }
      };
    
      const checkAnsweredData = () => {
        answeredQuestions = 0;
        questions.forEach(question => {
          const answerNo = question.querySelectorAll('input:checked').length;
          const inputType = question.querySelector('input');
          const parentnextBtn = question.querySelector(
            '.progressive-profile__questions--list__navigation--up-down .next'
          );
          const parentnextCta = question.querySelector(
            '.cta.cta--efl.personalisationNext'
          );
          // const { ctaText } = parentnextCta.dataset;
    
          if (inputType.type === 'checkbox' || inputType.type === 'radio') {
            if (answerNo) {
              question.setAttribute('data-answered', 'true');
              parentnextCta.setAttribute('aria-disabled', 'false');
              parentnextBtn.setAttribute('aria-disabled', 'false');
              // parentnextCta.innerHTML = `${ctaText}(${answerNo})`;
              editPreference.innerHTML = editCta;
              editPreference.setAttribute(
                'aria-label',
                'edit the profile preferences'
              );
              answeredQuestions += 1;
            }
          }
        });
      };
    
      const updateIndexCardData = () => {
        if (answeredQuestions && answeredQuestions === questions.length) {
          if (completedTitle) {
            bannerOverlay.querySelector('h2').innerHTML = completedTitle;
            bannerOverlay.querySelector('p').innerHTML = editCopy;
            bannerOverlay.querySelector('p').classList.remove('hidden');
          }
        } else if (answeredQuestions) {
          if (inprogressTitle) {
            bannerOverlay.querySelector('h2').innerHTML = inprogressTitle;
            bannerOverlay.querySelector('p').innerHTML = editCopy;
            bannerOverlay.querySelector('p').classList.add('hidden');
          }
        }
      };
    
      async function updatePersonalisationDataCallback(personalisationData) {
        const url = `/Personalise/UpdateProgressivePersonalisation`;
        // eslint-disable-next-line compat/compat
        const response = await fetch(url, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Cache-Control': 'no-cache',
            Pragma: 'no-cache',
            Expires: '0',
          },
          body: personalisationData,
        });
    
        return response.json();
      }
    
      function updatePersonalisationData(personalisationData) {
        try {
          // isAjaxRuning = true;
          updatePersonalisationDataCallback(personalisationData).then(response => {
            if (response) {
              // console.log(response);
              editPreference.innerHTML = editCta;
              editPreference.setAttribute(
                'aria-label',
                'edit the profile preferences'
              );
              checkAnsweredData();
              updateIndexCardData();
            }
          });
        } catch (e) {
          throw new Error('Unable to update personalisation data ::', e);
        }
      }
    
      const generatePersonalisationData = () => {
        const eflPersonalisation = [];
    
        questions.forEach((question, index) => {
          const questionElment = question.querySelector('.question');
          const { questionsType } = question.dataset;
          const { questionId } = questionElment.dataset;
          const questionText = questionElment.innerText;
    
          const answerDetails = [];
          const answerOptions = question.querySelectorAll('input');
          let inc = 0;
    
          answerOptions.forEach(option => {
            if (option.checked) {
              const { optionId } = option.closest(
                '.all-questions__single--answers'
              ).dataset;
              const answer = `{
                "answer": "${option.value}",
                "answerId": "${optionId}"
              }`;
    
              answerDetails[inc] = JSON.parse(answer);
              inc += 1;
            }
          });
    
          const questionDetails = `{
            "question": "${questionText}",
            "questionId": "${questionId}",
            "questionTag": "${questionsType}",
            "answerDetails": ${JSON.stringify(answerDetails)}
          }`;
    
          eflPersonalisation[index] = JSON.parse(questionDetails);
        });
    
        const personalisationData = `{
          "id": "${fanid}",
          "eflPersonalisation": ${JSON.stringify(eflPersonalisation)}
        }`;
    
        // console.log(personalisationData);
    
        return personalisationData;
      };
    
      window.addEventListener('DOMContentLoaded', () => {
        progressBar.setAttribute('max', questions.length);
      });
    
      // functions
      questions.forEach((question, index) => {
        const text = question.querySelector('.all-questions__single__index');
        const currentnextBtn = question.querySelector(
          '.progressive-profile__questions--list__navigation--up-down .next'
        );
        const currentprevBtn = question.querySelector(
          '.progressive-profile__questions--list__navigation--up-down .previous'
        );
        const nextCta = question.querySelector('.cta.cta--efl.personalisationNext');
        const signinprevBtn = parentElement.querySelector(
          '.progressive-profile__sign-in .previous'
        );
        const currentIndex = index < 9 ? `0${index + 1}` : index + 1;
        const totalQuestions =
          questions.length < 9 ? `0${questions.length}` : questions.length;
    
        text.innerHTML = `Question ${currentIndex}/${totalQuestions}`;
    
        const answerNo = question.querySelectorAll('input:checked').length;
        const inputType = question.querySelector('input');
        const parentnextBtn = question.querySelector(
          '.progressive-profile__questions--list__navigation--up-down .next'
        );
        const parentnextCta = question.querySelector(
          '.cta.cta--efl.personalisationNext'
        );
        // const { ctaText } = parentnextCta.dataset;
    
        if (inputType.type === 'checkbox' || inputType.type === 'radio') {
          if (answerNo) {
            question.setAttribute('data-answered', 'true');
            parentnextCta.setAttribute('aria-disabled', 'false');
            parentnextBtn.setAttribute('aria-disabled', 'false');
            // parentnextCta.innerHTML = `${ctaText}(${answerNo})`;
            editPreference.innerHTML = editCta;
            editPreference.setAttribute(
              'aria-label',
              'edit the profile preferences'
            );
            answeredQuestions += 1;
          }
        }
    
        // previous question
        const goToPrevQuestion = () => {
          const prevQuestion = questions[progressBar.value - 2];
          const prevBtn = prevQuestion.querySelector(
            '.progressive-profile__questions--list__navigation--up-down .previous'
          );
          const nextBtn = prevQuestion.querySelector(
            '.progressive-profile__questions--list__navigation--up-down .next'
          );
          const prevnextCta = prevQuestion.querySelector(
            '.cta.cta--efl.personalisationNext'
          );
    
          if (!prevQuestion) {
            currentprevBtn.setAttribute('aria-disabled', 'false');
            return;
          }
    
          const questionHeight = prevQuestion.clientHeight;
    
          questionsContainer.style.minHeight = `${questionHeight}px`;
    
          if (progressBar.value <= 1) {
            progressBar.value -= 1;
            prevBtn.setAttribute('aria-disabled', 'true');
          } else {
            progressBar.value -= 1;
          }
    
          if (prevQuestion.getAttribute('data-answered') === 'true') {
            prevnextCta.setAttribute('aria-disabled', 'false');
            nextBtn.setAttribute('aria-disabled', 'false');
          } else {
            prevnextCta.setAttribute('aria-disabled', 'true');
            nextBtn.setAttribute('aria-disabled', 'true');
          }
    
          updateTabIndex(prevQuestion);
    
          gsap.to(questionsContainer, {
            transform: `translateY(-${prevQuestion.offsetTop}px)`,
            ease: 'power2',
            scrub: true,
            yoyo: 'true',
          });
        };
    
        // next question
        const goToNextQuestion = () => {
          if (!fanid) {
            questionsContainer.classList.add('sign-in');
            questionsContainer.style.minHeight = `${signIn.clientHeight}px`;
    
            updateTabIndex(signIn);
    
            gsap.to(questionsContainer, {
              transform: `translateY(-${signIn.offsetTop}px)`,
              ease: 'power2',
              scrub: true,
              yoyo: 'true',
            });
          } else {
            const personalisationData = generatePersonalisationData();
    
            updatePersonalisationData(personalisationData);
    
            if (progressBar.value === progressBar.max) {
              questionsContainer.classList.add('sign-in');
              questionsContainer.style.minHeight = `${successDiv.clientHeight}px`;
    
              updateTabIndex(successDiv);
    
              gsap.to(questionsContainer, {
                transform: `translateY(-${successDiv.offsetTop}px)`,
                ease: 'power2',
                scrub: true,
                yoyo: 'true',
              });
            }
          }
    
          if (!fanid || progressBar.value === progressBar.max) {
            return;
          }
    
          const nextQuestion = questions[progressBar.value];
          const prevBtn = nextQuestion.querySelector(
            '.progressive-profile__questions--list__navigation--up-down .previous'
          );
          const nextBtn = nextQuestion.querySelector(
            '.progressive-profile__questions--list__navigation--up-down .next'
          );
          const nextQuestionCta = nextQuestion.querySelector(
            '.cta.cta--efl.personalisationNext'
          );
          const questionHeight = nextQuestion.clientHeight;
    
          questionsContainer.style.minHeight = `${questionHeight}px`;
    
          if (progressBar.value < progressBar.max - 1) {
            progressBar.value += 1;
          } else {
            progressBar.value += 1;
            // nextBtn.setAttribute('aria-disabled', 'true');
          }
    
          if (progressBar.value >= 2) {
            prevBtn.setAttribute('aria-disabled', 'false');
          }
    
          if (nextQuestion.getAttribute('data-answered') === 'true') {
            nextQuestionCta.setAttribute('aria-disabled', 'false');
            nextBtn.setAttribute('aria-disabled', 'false');
          } else {
            nextQuestionCta.setAttribute('aria-disabled', 'true');
            nextBtn.setAttribute('aria-disabled', 'true');
          }
    
          updateTabIndex(nextQuestion);
    
          gsap.to(questionsContainer, {
            transform: `translateY(-${nextQuestion.offsetTop}px)`,
            ease: 'power2',
            scrub: true,
            yoyo: 'true',
          });
        };
    
        // Alert
        const openAlert = () => {
          const alert = questions[progressBar.value - 1].querySelector(
            '.all-questions__single--alert'
          );
    
          alert.classList.add('active');
        };
    
        nextCta.addEventListener('click', e => {
          e.preventDefault();
    
          if (nextCta.getAttribute('aria-disabled') === 'true') {
            openAlert();
            const currentQuestion = questions[progressBar.value - 1];
            const questionHeight = currentQuestion.clientHeight;
    
            questionsContainer.style.minHeight = `${questionHeight}px`;
            return;
          }
    
          goToNextQuestion();
    
          setTimeout(() => {
            closeBtns.focus();
          }, 100);
        });
    
        nextCta.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            nextCta.click();
            nextCta.blur();
          } else {
            e.preventDefault();
    
            closeBtns.focus();
          }
        });
    
        currentnextBtn.addEventListener('click', e => {
          e.preventDefault();
    
          if (currentnextBtn.getAttribute('aria-disabled') === 'true') {
            return;
          }
    
          goToNextQuestion();
    
          closeBtns.focus();
        });
    
        currentnextBtn.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            e.preventDefault();
    
            currentnextBtn.click();
          }
        });
    
        currentprevBtn.addEventListener('click', e => {
          e.preventDefault();
    
          if (currentprevBtn.getAttribute('aria-disabled') === 'true') {
            return;
          }
    
          goToPrevQuestion();
    
          closeBtns.focus();
        });
    
        currentprevBtn.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            e.preventDefault();
    
            currentprevBtn.click();
          }
        });
    
        // sign in functions
        if (signinprevBtn) {
          signinprevBtn.addEventListener('click', e => {
            e.preventDefault();
    
            if (currentprevBtn.getAttribute('aria-disabled') === 'true') {
              return;
            }
    
            const prevQuestion = questions[progressBar.value - 2];
            const prevBtn = prevQuestion.querySelector(
              '.progressive-profile__questions--list__navigation--up-down .previous'
            );
            const nextBtn = prevQuestion.querySelector(
              '.progressive-profile__questions--list__navigation--up-down .next'
            );
    
            // at sign in section
            if (questionsContainer.classList.contains('sign-in')) {
              const lastQuestion = questions[progressBar.value - 1];
    
              if (lastQuestion.getAttribute('data-answered') === 'true') {
                nextBtn.setAttribute('aria-disabled', 'false');
              } else {
                nextBtn.setAttribute('aria-disabled', 'true');
              }
    
              if (progressBar.value < 2) {
                prevBtn.setAttribute('aria-disabled', 'true');
              }
    
              questionsContainer.style.minHeight = `${lastQuestion.clientHeight}px`;
              questionsContainer.classList.remove('sign-in');
    
              updateTabIndex(lastQuestion);
    
              gsap.to(questionsContainer, {
                transform: `translateY(-${lastQuestion.offsetTop}px)`,
                ease: 'power2',
                scrub: true,
                yoyo: 'true',
              });
            }
          });
    
          signinprevBtn.addEventListener('keydown', e => {
            if (e.keyCode === 13) {
              e.preventDefault();
              signinprevBtn.click();
            }
          });
        }
    
        // Accessibility
        const updateOptLabel = () => {
          const questionElement = question.querySelector('.question');
          const questionText = questionElement.innerText;
          const answerOptions = question.querySelectorAll('input');
          const firstOpt = answerOptions[0];
          const optLabel = firstOpt.nextElementSibling;
          const optText = optLabel.innerText;
    
          if (firstOpt.type === 'checkbox') {
            firstOpt.setAttribute('aria-label', `${questionText} ${optText}`);
          } else if (firstOpt.type === 'radio') {
            const firstoptLabel = document.createElement('div');
    
            firstoptLabel.className = 'visually-hidden';
            firstoptLabel.innerText = `${questionText}`;
            optLabel.prepend(firstoptLabel);
          }
        };
    
        updateOptLabel();
      });
    
      updateIndexCardData();
    
      // Close Question Modal
      if (closeBtns) {
        closeBtns.addEventListener('click', e => {
          e.preventDefault();
    
          document.body.style.overflow = null;
          wrapper.classList.remove('enlarged-image');
          /* eslint-disable no-param-reassign */
          parentElement.classList.remove('expanded');
          parentElement.style.marginTop = ``;
          /* eslint-disable no-param-reassign */
          bannerOverlay.classList.remove('overlay-hidden');
    
          setTimeout(() => {
            questionsList.classList.remove('expanded');
          }, 10);
          closeBtns.blur();
          closeBtns.tabIndex = '-1';
          editPreference.focus();
          updateTabIndex();
        });
    
        closeBtns.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            closeBtns.click();
          } else if (e.shiftKey && e.keyCode === 9) {
            e.preventDefault();
          } else {
            // empty
          }
        });
      }
    
      /* window.addEventListener('scroll', () => {
        const containerHeight = document.documentElement.clientHeight;
        const allNavigation = parentElement.querySelectorAll(
          '.progressive-profile__questions--list__navigation--up-down'
        );
        const bottomGap = 102;
    
        allNavigation.forEach(nav => {
          // eslint-disable-next-line no-param-reassign
          nav.style.top = `${containerHeight - bottomGap}px`;
        });
      }); */
    
      window.addEventListener('click', e => {
        const clickedElement = e.target;
    
        if (clickedElement.tagName === 'INPUT') {
          const questionsContainerParent = clickedElement.closest(
            '.all-questions__single'
          );
          const progressiveProfile = clickedElement.closest('.progressive-profile');
    
          if (!questionsContainerParent || !progressiveProfile) {
            return;
          }
    
          const alert = questionsContainerParent.querySelector(
            '.all-questions__single--alert'
          );
          const inputs = questionsContainerParent.querySelectorAll('input');
          const parentnextBtn = questionsContainerParent.querySelector(
            '.progressive-profile__questions--list__navigation--up-down .next'
          );
          const parentnextCta = questionsContainerParent.querySelector(
            '.cta.cta--efl.personalisationNext'
          );
    
          if (clickedElement.type === 'checkbox') {
            let answered = false;
    
            inputs.forEach(element => {
              if (element.checked) {
                answered = true;
              }
            });
    
            if (answered === true) {
              questionsContainerParent.setAttribute('data-answered', 'true');
              parentnextCta.setAttribute('aria-disabled', 'false');
              parentnextBtn.setAttribute('aria-disabled', 'false');
              // if alert is active, remove it
              alert.classList.remove('active');
              const currentQuestion = questions[progressBar.value - 1];
              const questionHeight = currentQuestion.clientHeight;
    
              // parentnextCta.innerHTML = `${ctaText}(${answerNo})`;
              questionsContainer.style.minHeight = `${questionHeight}px`;
            } else {
              questionsContainerParent.setAttribute('data-answered', 'false');
              parentnextCta.setAttribute('aria-disabled', 'true');
              parentnextBtn.setAttribute('aria-disabled', 'true');
              // parentnextCta.innerHTML = `${ctaText}`;
            }
          } else if (clickedElement.type === 'radio') {
            questionsContainerParent.setAttribute('data-answered', 'true');
            parentnextCta.setAttribute('aria-disabled', 'false');
            parentnextBtn.setAttribute('aria-disabled', 'false');
            // parentnextCta.innerHTML = `${ctaText}(${answerNo})`;
            alert.classList.remove('active');
            const currentQuestion = questions[progressBar.value - 1];
            const questionHeight = currentQuestion.clientHeight;
    
            questionsContainer.style.minHeight = `${questionHeight}px`;
          }
        }
      });
    
      window.addEventListener('keydown', event => {
        if ((event.keyCode === 13 || event.keyCode === 32) && parentElement) {
          const { target } = event;
          const progressiveProfile = target.closest('.progressive-profile');
    
          if (!progressiveProfile) {
            return;
          }
    
          if (target.previousElementSibling) {
            if (target.previousElementSibling.type === 'radio') {
              target.click();
              target.focus();
            }
          } else if (target.type === 'checkbox') {
            target.click();
            target.focus();
          }
        }
      });
    
      if (signinSignupPrev) {
        signinSignupPrev.addEventListener('click', e => {
          e.preventDefault();
    
          updateTabIndex(allQuestionsItem[0]);
    
          gsap.to(questionsContainer, {
            transform: `translateY(0)`,
            ease: 'power2',
            scrub: true,
            yoyo: 'true',
          });
        });
    
        signinSignupPrev.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            e.preventDefault();
            signinSignupPrev.click();
          }
        });
      }
    
      // Open Questions Component
      editPreference.addEventListener('click', e => {
        e.preventDefault();
    
        document.body.style.overflow = 'hidden';
        wrapper.classList.add('enlarged-image');
        /* eslint-disable no-param-reassign */
        parentElement.classList.add('expanded');
        parentElement.style.marginTop = `${-(
          parentElement.offsetTop - window.scrollY
        )}px`;
        /* eslint-disable no-param-reassign */
        bannerOverlay.classList.add('overlay-hidden');
        navigation.classList.remove('hidden');
    
        progressBar.value = 1;
    
        updateTabIndex(allQuestionsItem[0]);
        closeBtns.tabIndex = '0';
        closeBtns.focus();
    
        gsap.to(questionsContainer, {
          transform: `translateY(0px)`,
          ease: 'power2',
          scrub: true,
          yoyo: 'true',
        });
    
        setTimeout(() => {
          questionsList.classList.add('expanded');
        }, 10);
      });
    
      editPreference.addEventListener('keydown', e => {
        if (e.keyCode === 13) {
          e.preventDefault();
          editPreference.click();
        }
      });
    
      updateTabIndex();
    };
    
  • URL: /components/raw/progressive-profile/progressive-profile.js
  • Filesystem Path: src/library/components/progressive-profile/progressive-profile.js
  • Size: 23 KB
  • Content:
    @import 'node_modules/@glidejs/glide/src/assets/sass/glide.core';
    /* stylelint-disable no-descending-specificity */
    .progressive-profile {
      width: 100%;
      min-height: 57rem;
      overflow: hidden;
      justify-content: center;
      margin: 0 auto;
      position: relative;
      transition: margin-top 0.8s cubic-bezier(0.83, 0, 0.17, 1);
      &.inline-component {
        border-radius: 8px;
      }
      &.expanded {
        z-index: 220;
      }
      .overlay-hidden {
        opacity: 0;
        transform: translateY(-100%);
        transition: all 0.8s linear;
      }
      &__wrapper {
        height: 57rem;
        transition: height 0.8s cubic-bezier(0.83, 0, 0.17, 1);
        overflow: hidden;
        &.enlarged-image {
          height: 100vh;
          position: fixed;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
          z-index: 110;
          &::before {
            transform: translateY(-100%);
            transition: transform 0.8s linear;
          }
          &::after {
            transform: translateY(100%);
            transition: transform 0.8s linear;
          }
          .promo-background {
            filter: blur(1px);
          }
          .progress-bar-line {
            opacity: 1;
            transition: opacity 0.8s;
            transition-delay: 1.5s;
          }
          .close-btn {
            opacity: 1;
            transition: opacity 0.8s;
            transition-delay: 1.5s;
          }
        }
    
        picture {
          .promo-background {
            position: absolute;
            height: 100%;
            z-index: 0;
            top: 0;
            left: 0;
            right: 0;
            width: 100%;
            object-fit: cover;
          }
        }
      }
      &__overlay {
        width: 100%;
        max-width: 31.7rem;
        position: relative;
        display: flex;
        margin: 0 auto;
        z-index: 2;
        height: 57rem;
        opacity: 1;
        transform: translateY(0);
        transition: all 0.8s linear;
        &--wrapper {
          display: flex;
          align-items: center;
          flex-direction: column;
          margin: auto auto;
          position: initial;
          z-index: 2;
          color: $white;
          text-align: center;
          img {
            margin-bottom: 1.6rem;
            width: 4rem;
            height: 4.8rem;
          }
          h2 {
            @extend .efl-heading-1-hp;
    
            @include text-limit(2);
    
            margin-bottom: 0.8rem;
            max-width: 31.7rem;
          }
          p {
            @extend .efl-p-large;
    
            @include text-limit(3);
    
            letter-spacing: 0.02em;
            color: $light-blue;
          }
          .cta {
            width: 100%;
            max-width: 26.3rem;
            border: none;
            line-height: 1.8rem;
            letter-spacing: 0.02em;
            margin-top: 1.6rem;
            &:hover {
              background-color: $white;
              color: $red;
            }
          }
        }
      }
      button {
        color: $white;
      }
    
      &__container {
        max-width: 124.4rem;
        margin: 0 auto;
        padding-bottom: 5rem;
      }
    
      &__sign-in {
        @include rte();
    
        background-size: cover;
        background-position: left bottom;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    
        &__content {
          h2,
          h3,
          p {
            max-width: 46.3rem;
          }
          p {
            font-size: 1.8rem !important;
            line-height: 2.4rem !important;
          }
    
          ul {
            padding-left: 0;
          }
    
          ul li {
            display: flex;
            gap: 2rem;
            align-items: center;
    
            &::marker {
              content: '';
            }
    
            &::before {
              content: '';
              display: block;
              background-image: url('./assets/images/Tick.svg');
              background-repeat: no-repeat;
              background-size: cover;
              width: 3rem;
              height: 3rem;
            }
          }
          .efl-category-title {
            &--desktop {
              display: none;
            }
          }
        }
    
        &--inner {
          h1,
          h2,
          h3,
          h4,
          h5,
          a,
          li {
            color: $white;
          }
          p {
            color: $light-blue;
          }
    
          a:hover {
            color: $white;
            cursor: pointer;
          }
    
          margin: 0 auto;
          grid-template-columns: 1fr 1fr;
          justify-content: space-between;
          align-items: center;
          max-width: 100%;
    
          &.benefits {
            max-height: calc(100vh - 60px);
            overflow-y: scroll;
            overflow-x: hidden;
            .progressive-profile__sign-in__content {
              border-right: none;
              &.thanks-screen {
                padding: 0 3.2rem;
              }
            }
    
            // gap between keyline
            > *:last-child {
              padding-top: 3rem;
            }
    
            .not-today {
              text-align: center;
              color: $white;
              opacity: 0.7;
            }
          }
        }
    
        &__cards {
          display: flex;
          overflow-x: scroll;
          gap: 1.6rem;
          height: 100%;
          padding-left: 3.2rem;
    
          .efl-carousel-card {
            min-width: 20rem;
            margin: 0;
          }
    
          &::-webkit-scrollbar {
            width: 0.2rem;
          }
    
          .registration {
            display: flex;
            flex-direction: column;
            flex-wrap: wrap;
            gap: 2rem;
          }
        }
    
        &__registration {
          display: flex;
          justify-content: center;
          flex-direction: column;
          gap: 2rem;
    
          &--links {
            display: flex;
            flex-direction: column;
            gap: 2rem;
    
            .cta {
              width: 100%;
              min-width: 22.8rem;
              text-decoration: none;
              max-width: none;
              &:hover {
                text-decoration: none;
              }
            }
    
            .sign-in-cta {
              border: 0.2rem solid $white;
              background-color: rgba(255, 255, 255, 0.1);
              &:hover {
                background-color: $white;
                color: $blue;
              }
            }
    
            .sign-up-cta {
              border: none;
              &:hover {
                color: $white;
              }
            }
          }
        }
        &:not(.benefits) {
          .progressive-profile__sign-in--inner {
            padding: 0 3.2rem;
          }
        }
        .progressive-profile__questions--list__navigation--up-down {
          margin-top: 0;
          margin-right: 3.2rem;
        }
      }
    
      &__questions {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        color: $white;
        overflow: hidden;
        &--container {
          position: relative;
          .close-btn {
            content: '';
            cursor: pointer;
            display: block;
            position: absolute;
            width: 4rem;
            height: 4rem;
            top: 2.3rem;
            right: 3.2rem;
            background: url('./assets/images/close-onboard.svg') no-repeat;
            background-size: cover;
            border: none;
            z-index: 2;
            opacity: 0;
          }
        }
        &--list {
          display: flex;
          position: relative;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          background-repeat: no-repeat;
          background-position: left bottom;
          opacity: 0;
          transform: translateY(100%);
          transition: all 0.8s linear;
    
          &.expanded {
            min-height: calc(100vh - 1.1rem);
            opacity: 1;
            transform: translateY(0);
            transition: all 0.8s linear;
            &::after {
              filter: blur(2px);
            }
          }
    
          .glide-carousel__pagination {
            margin-top: 2.4rem;
            padding-bottom: 3.2rem;
          }
    
          .all-questions {
            position: relative;
            max-height: 100vh;
    
            .question {
              color: $white;
              display: flex;
              align-items: center;
    
              @extend .efl-heading-3;
    
              span {
                background: url('./assets/images/arrow-next-white.svg') no-repeat
                  center right;
                display: inline-block;
                padding-right: 2.4rem;
                font-size: 1.8rem;
                line-height: 1.6rem;
                margin-right: 0.8rem;
              }
            }
            .info {
              @extend .efl-p-small;
    
              color: $light-blue;
              margin-bottom: 1.6rem;
            }
    
            &__questions-sector {
              display: flex;
              flex-direction: column;
              justify-content: space-between;
            }
    
            &__single {
              display: flex;
              flex-direction: column;
              justify-content: center;
              min-height: 100vh;
              transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
              &__index {
                font-family: $text-font-ef;
                text-transform: uppercase;
                color: $light-blue;
                margin-bottom: 1.6rem;
    
                @extend .efl-category-title;
              }
              &--answers {
                position: relative;
                input[type='checkbox'] {
                  position: absolute;
                  width: 1.8rem;
                  height: 1.8rem;
                  top: 0.5rem;
                  left: 1.3rem;
                  border: 0.1rem solid $light-blue;
                  -webkit-appearance: none;
                  appearance: none;
                }
                input[type='checkbox']:checked {
                  background-image: url('./assets/images/bundle-tick-option-icon.svg');
                  background-position: center;
                  background-repeat: no-repeat;
                  background-size: contain;
                  border: none;
                }
                input[type='radio'] {
                  display: none;
                }
                input[type='radio'] + label {
                  padding-left: 1.2rem;
                }
                label {
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  text-align: center;
                  padding: 0.4rem 1.2rem;
                  border: 0.2rem solid $white;
                  border-radius: 0.4rem;
                  margin-bottom: 0.8rem;
                  padding-left: 4rem;
                  transition: background-color 0.2s ease-in-out;
                  cursor: pointer;
    
                  @extend .efl-p-medium;
                }
                input:checked + label {
                  background-color: $white;
                  color: $blue;
                }
              }
              &--options {
                display: flex;
                flex-direction: column;
                width: auto;
                max-width: none;
    
                .cta.personalisationNext {
                  height: 4.4rem;
                  max-width: none;
                  width: 100%;
                  border: none;
                  border-radius: 0.2rem;
                  margin-top: 1.6rem;
    
                  @extend .efl-p-small;
                  &:hover {
                    background-color: $white;
                    color: $blue;
                  }
                  &:disabled,
                  &[aria-disabled='true'] {
                    background-color: rgba(236, 238, 243, 0.5);
                    color: $white;
                    cursor: default;
                    &:hover {
                      background-color: rgba(236, 238, 243, 0.5);
                      color: $white;
                    }
                  }
                }
              }
              &--alert {
                display: none;
                align-items: center;
                max-width: fit-content;
                border-radius: 0.4rem;
                padding: 0.6rem 2.3rem 0.6rem 1.6rem;
                background-color: $white;
                color: $blue;
                line-height: 2.4rem;
                letter-spacing: 0;
    
                @extend .efl-heading-6;
    
                &.active {
                  display: flex;
                  margin: 1.6rem 0 2.4rem 0;
                }
                &::before {
                  content: '';
                  display: block;
                  background: url('./assets/images/alert-icon.svg') no-repeat center;
                  width: 1.8rem;
                  height: 1.8rem;
                  margin-right: 1rem;
                }
              }
            }
    
            &__feedback {
              display: flex;
              flex-direction: column;
              justify-content: center;
              text-align: center;
              width: 100%;
              max-width: 50.1rem;
              margin: 0 auto;
              min-height: 100vh;
              &--right-icon {
                width: 9.6rem;
                height: 9.6rem;
                margin: 0 auto;
                margin-bottom: 1.6rem;
              }
              &--wrong-icon {
                width: 9.6rem;
                height: 9.6rem;
                margin: 0 auto;
                margin-bottom: 1.6rem;
              }
              h3 {
                color: #fff;
                margin-bottom: 0.8rem;
    
                @extend .efl-heading-2;
              }
              p {
                color: #b7c5e9;
                margin-bottom: 1.6rem;
    
                @extend .efl-p-medium;
              }
              .feedbackNext {
                margin: 0 auto;
                width: 100%;
                max-width: 31.1rem;
                border: none;
                &:hover {
                  color: $crest-blue;
                  background-color: $white;
                }
              }
            }
    
            &__video-wrap {
              iframe {
                width: 100%;
                height: calc(56.25vw);
              }
            }
            &__video-poster {
              display: none;
            }
            &__player {
              display: none;
            }
            &__video-thumbnail {
              button {
                display: block;
                position: relative;
                border: none;
                background: transparent;
                cursor: pointer;
                width: 100%;
                padding: 0;
                &::after {
                  content: '';
                  background: url(./assets/images/bundled-play-button.svg) no-repeat
                    center;
                  display: block;
                  position: absolute;
                  left: 0;
                  width: 5.2rem;
                  height: 5.2rem;
                  bottom: 0;
                  border: 0;
                  border-radius: 0;
                }
                img {
                  width: 100%;
                  object-fit: cover;
                }
              }
            }
    
            .question-video {
              .all-questions__single--section {
                max-width: none;
              }
              .all-questions__questions-sector {
                flex-direction: column;
              }
              .all-questions__question-wrap {
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                max-width: none;
              }
            }
          }
    
          &__navigation {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            width: 100%;
            margin-top: 1.6rem;
            &--up-down {
              position: initial;
              display: flex;
              margin-top: 0.2rem;
              button {
                height: 4.2rem;
                width: 4.2rem;
                border: 0.2rem solid $white;
                border-radius: 0.4rem;
                background-color: rgba(255, 255, 255, 0.1);
                background-image: url('./assets/images/caret-white.svg');
                background-repeat: no-repeat;
                background-position: center;
                background-size: 1.1rem 0.6rem;
                cursor: pointer;
                &:hover {
                  background-color: rgba(183, 197, 233, 0.5);
                }
                &[aria-disabled='true'] {
                  border: none;
                  background-color: rgba($light-blue, 0.5);
                  cursor: default;
                }
              }
              .previous {
                margin-right: 0.8rem;
                transform: rotate(180deg);
              }
            }
    
            .cta.personalisationNext {
              height: 4.4rem;
              max-width: none;
              width: 100%;
              border: none;
              border-radius: 0.2rem;
    
              @extend .efl-p-small;
              &:hover {
                background-color: $white;
                color: $blue;
              }
              &:disabled,
              &[aria-disabled='true'] {
                background-color: rgba(236, 238, 243, 0.5);
                color: $white;
                cursor: default;
                &:hover {
                  background-color: rgba(236, 238, 243, 0.5);
                  color: $white;
                }
              }
            }
          }
    
          .all-questions,
          .bundled-learning-promo__questions--list__navigation {
            width: 100%;
            z-index: 99;
            .all-questions__single {
              max-width: 87.5rem;
              margin: 0 auto;
              padding: 0 3.2rem;
            }
            .progressive-profile__sign-in {
              max-width: 111.4rem;
              margin: 0 auto;
            }
          }
        }
      }
    
      .progress-bar-line {
        width: 100%;
        height: 0.5rem;
        background-color: $grey-light;
        border-radius: 1rem;
        position: relative;
        left: 0;
        bottom: 0;
        display: block;
        opacity: 0;
    
        span {
          height: 0.2rem;
          background-color: $red;
          border-radius: 1rem;
          position: absolute;
          left: 0;
          bottom: 0;
          z-index: 1;
          display: inline-block;
        }
      }
    
      progress {
        background-color: $grey-light;
    
        &::-webkit-progress-bar {
          background-color: $grey-light;
        }
    
        &::-webkit-progress-value {
          background-color: $red;
          transition: width ease-in 0.3s;
        }
    
        &::-moz-progress-bar {
          background-color: $red;
          transition: all ease-in 0.3s;
        }
      }
    
      @media screen and (max-width: 1199px) {
        &__questions {
          &--list {
            &__navigation {
              &--up-down {
                position: relative;
                right: 0;
                order: 1;
                margin-top: 2.8rem;
                justify-content: end;
              }
            }
          }
        }
      }
    
      @media screen and (min-width: $mq-large) {
        min-height: 44rem;
        .progress-bar-line {
          height: 1.1rem;
        }
        &__wrapper {
          height: 44rem;
        }
        &__overlay {
          height: 44rem;
          max-width: 67.9rem;
          &--wrapper {
            h2 {
              max-width: 100%;
            }
            p {
              @include text-limit(2);
    
              font-size: 2rem;
              line-height: 3.2rem;
            }
            .cta {
              width: 100%;
              max-width: 27rem;
            }
          }
          &--details {
            p {
              &:first-child {
                padding-right: 2.4rem;
              }
              &:last-child {
                padding-left: 2.4rem;
              }
            }
          }
        }
        &__questions {
          &--container {
            .close-btn {
              top: 5.9rem;
              right: 5.6rem;
              width: 5.1rem;
              height: 5.1rem;
            }
          }
          &--list {
            &__navigation {
              flex-direction: row;
              button {
                margin-left: auto;
              }
              .cta.personalisationNext {
                max-width: 37.3rem;
              }
            }
          }
        }
    
        &__sign-in {
          grid-template-columns: 1fr 1fr;
    
          &__content {
            min-height: 33.9rem;
            align-items: start;
            justify-content: center;
            display: flex;
            flex-direction: column;
          }
    
          &__cards {
            overflow-x: unset;
            justify-content: center;
            margin-right: 0;
    
            .efl-carousel-card:hover::before {
              margin-top: 2.3rem;
            }
          }
    
          &--inner {
            display: grid;
            grid-template-columns: 46.3rem 1fr;
            max-width: 113.2rem;
            gap: 3.2rem;
          }
    
          &--inner.benefits {
            min-height: 39.2rem;
            max-height: initial;
            overflow: initial;
    
            > div:first-child {
              border-bottom: none;
    
              p {
                font-size: 2rem !important;
                line-height: 3.2rem !important;
              }
            }
    
            > div:last-child {
              display: flex;
              flex-direction: row;
              padding-top: 6.2rem;
              gap: 3.2rem;
            }
          }
    
          &__registration {
            flex-direction: column;
            gap: 2.6rem;
    
            &--links {
              gap: 2rem;
              .cta {
                min-width: 37.3rem;
              }
            }
          }
          .progressive-profile__questions--list__navigation--up-down {
            margin-left: 3.6rem;
          }
          &:not(.benefits) {
            .progressive-profile__sign-in--inner {
              grid-template-columns: 43.6rem 1fr;
            }
            .progressive-profile__sign-in--inner h3 {
              font-size: 4.2rem;
              line-height: 4rem;
              letter-spacing: -0.01em;
            }
            .progressive-profile__questions--list__navigation {
              max-width: 90.2rem;
              margin: 0 auto;
            }
          }
        }
        .all-questions {
          .question {
            font-weight: 700;
            font-size: 4.2rem;
            line-height: 4rem;
            margin-bottom: 0.8rem;
          }
          .info {
            font-size: 1.8rem;
            letter-spacing: 0.02em;
          }
          &__questions-sector {
            flex-direction: row;
          }
          &__question-wrap {
            width: 100%;
            max-width: 37.3rem;
            align-items: flex-end;
            display: flex;
          }
          &__single {
            &__index {
              line-height: 2rem;
            }
            &--answers {
              input[type='checkbox'] {
                top: 1rem;
              }
              label {
                font-size: 2rem;
                line-height: 3.2rem;
              }
            }
            &--options {
              width: 100%;
              max-width: 37.3rem;
    
              .cta.personalisationNext {
                max-width: 37.3rem;
              }
            }
            &--section {
              width: 100%;
              max-width: 44.6rem;
              display: flex;
              flex-direction: column;
              justify-content: center;
            }
          }
    
          &__video-wrap {
            width: 46.1rem;
            height: 27.2rem;
            margin-right: 2rem;
            iframe {
              width: 46.1rem;
              height: 27.2rem;
            }
          }
    
          .question-video {
            .all-questions__question-wrap {
              flex-direction: row;
            }
            .bundled-learning-promo__questions--list__navigation {
              margin-top: 3.8rem;
            }
          }
        }
      }
    }
    
  • URL: /components/raw/progressive-profile/progressive-profile.scss
  • Filesystem Path: src/library/components/progressive-profile/progressive-profile.scss
  • Size: 21.5 KB
<section class="progressive-profile {{modifier}}" data-behavior="progressive-profile" data-fanid="111">
    <div class="progressive-profile__wrapper">
        <picture>
            <source media="(max-width: 819px)" srcset="{{smallimage}}">
            <source media="(min-width: 820px)" srcset="{{bigimage}}">
            <img src="{{bigimage}}" class="promo-background" alt="">
        </picture>

        <div class="progressive-profile__overlay">
            <div class="progressive-profile__overlay--wrapper">
                <img src="/assets/example-content/efl-logo-shield-white.svg" alt="">
                <h2 data-inprogress-title="{{inprogress-title}}" data-completed-title="{{completed-title}}">{{title}}
                </h2>
                <p data-edit-copy="{{edited-copy}}">{{copy}}</p>
                <button class="cta cta--efl  " id="edit-profile-preference" data-edit-cta="EDIT preferences" aria-label="start now to personalize your preferences">Start Now</button>
            </div>
        </div>
        <div class="progressive-profile__questions" role="dialog" aria-modal="true">
            <div class="progressive-profile__questions--container">
                <progress value="1" class="progress-bar-line"></progress>
                <button class="close-btn" tabindex="-1" aria-label="close the profile preferences">
                    <span class="visually-hidden">Close dialog</span>
                </button>
                <div class="progressive-profile__questions--list">
                    <div class="all-questions">
                        {{#each questions-list}}
                        <div class="all-questions__single" data-questions-type="{{question-type}}">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        {{question}}</div>
                                    <p class="info">{{answer-tip}}</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    {{#if video}}
                                    <div class="all-questions__video-wrap" data-video-type="{{type}}"
                                        data-video-id="{{videoId}}">
                                        <div class="all-questions__video-poster">
                                            <img src="/assets/example-content/video-error-poster.jpg" alt="error-video"
                                                loading="lazy" />
                                        </div>
                                        <div class="all-questions__video-thumbnail">
                                            <button aria-label="play {{type}} video player">
                                                {{#unless no-thumbnail}}
                                                <img src="/assets/example-content/quiz-video-thumbnail.jpg" alt=""
                                                    loading="lazy" />
                                                {{/unless}}
                                            </button>
                                        </div>
                                        <div id="all-questions" class="all-questions__player"></div>
                                    </div>
                                    {{/if}}
                                    <ul class="all-questions__single--options">
                                        {{#each answers}}
                                        <div class="all-questions__single--answers"
                                            data-option-id="e94b8e0fe57d4668a15f0122c4098c83">
                                            {{#if ../multi-answer}}
                                            <input name="{{name}}" type="checkbox" class="multi-answer" id="{{id}}"
                                                value="{{value}}" {{#if checked}}checked{{/if}} tabindex="-1">
                                            {{/if}}
                                            {{#unless ../multi-answer}}
                                            <input name="{{name}}" type="radio" class="single-answer" id="{{id}}"
                                                value="{{value}}" {{#if checked}}checked{{/if}} tabindex="-1">
                                            {{/unless}}
                                            <label for="{{id}}">{{value}}</label>
                                        </div>
                                        {{/each}}
                                    </ul>
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                                {{#unless video}}
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true"
                                    aria-label="next preference" data-cta-text="Next">Next</button>
                                {{/unless}}
                            </div>
                        </div>
                        {{/each}}
                        <div class="progressive-profile__sign-in benefits">
                            <div class="progressive-profile__sign-in--inner benefits">
                                <div class="progressive-profile__sign-in__content thanks-screen">
                                    <h2>Thanks, {{userName}}</h2>
                                    <p>We have saved your preferences, and we will be using this information to curate
                                        content that is specifically tailored
                                        to your interests and needs.
                                    </p>
                                    <br>
                                    <p>Now is the perfect time to get started with our articles
                                        and sessions that are tailored to your profile.</p>
                                    <br>
                                    <p>You can change your preferences in future here <strong
                                            style="text-decoration: underline;"><a
                                                class="change-preferences-again">here</a></strong></p>

                                </div>
                                <div class="progressive-profile__sign-in__cards">
                                    {{render '@efl-carousel-card--large'}}
                                    {{render '@efl-carousel-card--large'}}
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="false" class="previous" aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                            </div>
                        </div>
                        <div class="progressive-profile__sign-in">
                            <div class="progressive-profile__sign-in--inner">
                                <div class="progressive-profile__sign-in__content">
                                    <h3>In order to personalise your experience, please sign up or sign in so we can
                                        save your prefrences</h3>
                                    <p>Benefits of creating your own personalised experience</p>
                                    <p>We will tailor your site content moving forward.</p>
                                    <ul>
                                        <li>Content you care about</li>
                                        <li>Sessions tailored to your team</li>
                                        <li>Course information and alerts</li>
                                    </ul>
                                </div>
                                <div class="progressive-profile__sign-in__registration">
                                    <div class="progressive-profile__sign-in__registration--links">
                                        {{render '@cta--efl' sign-up-cta merge=true}}
                                        {{render '@cta--efl' sign-in-cta merge=true}}
                                    </div>
                                </div>
                            </div>
                            <div class="progressive-profile__questions--list__navigation">
                                <div class="progressive-profile__questions--list__navigation--up-down">
                                    <button aria-disabled="false" class="previous signin-signup-prev"
                                        aria-label="previous preference"></button>
                                    <button aria-disabled="true" class="next" aria-label="next preference"></button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>