ArticleTemplates/assets/scss/modules/_quiz.scss (444 lines of code) (raw):

// Quiz Block .element-atom { .quiz { counter-reset: question-counter; @include mq($from: col4) { margin: 0; } &__correct-answers-title, &__correct-answers { display: none; } // Quiz title .quiz__title { color: color(brightness-7); font: 200 26px/1.2 $egyptian-display; margin-bottom: 36px; @include mq($from: col4) { font-size: 28px; } } // Question Block .quiz__question { counter-increment: question-counter; margin-top: 12px; margin-bottom: 30px; &::before { content: ''; } &:last-child { margin-bottom: 0px; } } // Question Styles .question__wrapper { padding-top: 3px; position: relative; img { width: 100%; margin: 12px 0; } } .question__text { font-family: $egyptian-display; font-weight: 600; min-height: 50px; padding: 0 0 6px 72px; position: relative; &::before { content: counter(question-counter); font: 100 50px/1 $egyptian-display; left: 0; position: absolute; top: 3px; width: 60px; } } .question__img { display: block; width: 100%; } .question__answers { clear: both; margin: 0; padding: 0; } // Vary the styles when the question has an image .question.has-image { .question__wrapper { padding-top: 0; @include mq($from: col2) { margin: { left: 0; right: 0; } } } .question__text { margin: 0; padding-top: 3px; &::before { left: 12px; top: 0; } } } // Answer Block .question__answer { margin-bottom: 7px; position: relative; &::before { content: ''; } } // Answer Styles .answer__wrapper { background: color(brightness-93); min-height: 55px; overflow: hidden; padding: 5px 6px 18px 72px; position: relative; width: 100%; } .answer__buckets { display: none; } .answer__text, .answer__message::before { color: color(brightness-46); display: block; font-family: $egyptian-display; font-weight: 600; margin: 0; padding: 0; } // This before controls the answer input / correct & wrong markers .answer__marker { border: 1px dashed color(brightness-46); border-radius: 50%; height: 30px; left: 7px; position: absolute; top: 7px; transition: background .5s ease-in-out; width: 30px; z-index: 1; &::before { content: '\00e062'; opacity: 0; } } .answer__img { display: block; height: auto; width: 100%; } .answer__explanation { color: color(brightness-46); display: block; font: 500 13px/1.5 $egyptian-display; margin: 0; padding: 0; width: 100%; margin-top: 12px; } // Vary the answer styles once a question has been answered .question.answered { .answer__wrapper { background: #f5f5f5; } .answer__text { color: color(brightness-60); } .answer__marker { border-color: color(brightness-60); } } // Vary the styles when the answer has an image .answer.has-image { .answer__wrapper { background: transparent; padding: 0; } .answer__message { margin: 0; min-height: 55px; opacity: 0; position: absolute; padding: 5px 6px 18px 72px; top: 100%; width: 100%; } } // Common styles for correct and wrong answers .correct-answer, .wrong-answer { .answer__marker { border: 0; text-align: center; &::before { color: color(brightness-100); font-family: $icon; opacity: 1; } } .answer__message::before { display: block; font-size: 16px; } &.has-image { .answer__message { opacity: 1; } } } // Common style for correct answer whether question is-correct or is-wrong .correct-answer { .answer__marker { background: color(brightness-100); &::before { color: color(brightness-7); content: '\00e062'; line-height: 26px; } } } // Styles for answering correctly .question.is-correct { .correct-answer { .answer__wrapper, .answer__message { background: color(quiz-correct-answer); } .answer__marker { background: color(brightness-7); &::before { color: color(brightness-100); content: '\00e062'; line-height: 26px; } } .answer__text { color: color(brightness-100); } .answer__explanation { color: color(brightness-100); } &.has-image { .answer__marker { transition: background .5s ease-in-out, top .5s ease-in-out; &::before { transition: opacity .3s ease-in-out .2s; } } .answer__message { transition: top .5s ease-in-out; } } } } // Styles for wrong answers .question.is-wrong { .wrong-answer { .answer__wrapper, .answer__message { background: color(quiz-wrong-answer); } .answer__marker { background: color(brightness-7); &::before { content: '\00e04F'; line-height: 28px; } } .answer__text { color: color(brightness-100); } .answer__explanation { color: color(brightness-100); } &.has-image { .answer__marker { transition: background .5s ease-in-out, top .5s ease-in-out; &::before { transition: opacity .3s ease-in-out .2s; } } .answer__message { transition: top .5s ease-in-out; } } } .correct-answer { &.has-image { .answer__marker { transition: background .3s ease-in-out; &::before { transition: opacity .3s ease-in-out; } } .answer__message { background: #f5f5f5; transition: opacity .3s ease-in-out; } } } } // Hide default html scores .quiz__scores, .quiz__scores-title { display: none; } .quiz-results, .quiz-scores { background: transparent; margin: 0; max-height: 0; overflow: hidden; opacity: 0; padding: 0; transition: all 1s ease-in-out; &.open { opacity: 1; margin-top: 30px; max-height: 350px; } } // Quiz Scores .quiz-scores { background: transparent; margin: 0; max-height: 0; overflow: hidden; opacity: 0; padding: 0; transition: all 1s ease-in-out; .quiz-scores { &__inner { overflow: hidden; } &__img { display: block; width: 100%; } &__score { border-radius: 50%; float: left; font: 100 55px/160px $egyptian-display; height: 160px; margin: 12px 18px 12px 0; padding-top: 15px; position: relative; text-align: center; width: 160px; &::before { color: color(brightness-100); content: 'You scored:'; font-size: 18px; font-weight: 600; left: 25px; line-height: 1; position: absolute; top: 40px; } } &__correct { margin-right: -10px; } &__questions { margin-left: -10px; } &__message { font-family: $egyptian-display; font-weight: 600; margin-top: 60px; } } } // Editorial personality quiz &.personality-quiz { .question__wrapper .question__text { font-family: $egyptian-display; font-weight: 600; font-size: 18px; line-height: 21px; &::before { content: counter(question-counter); font: 50px/1 $egyptian-display; left: 0; position: absolute; top: 3px; width: 60px; } } .question__answer { &.highlight-answer.answer .answer__wrapper, &.highlight-answer.answer.has-image { background-color: color(brightness-86); } &:not(.has-image) { .answer__text { color: color(brightness-7); } .answer__marker { border: 1px solid color(brightness-60); &::before { content: ''; } } .answer__marker__inner { opacity: 0; background: color(brightness-20); border-radius: 50%; height: 16px; margin: 5.5px; width: 16px; z-index: 1; } } &.has-image { background: color(brightness-96); padding: 10px; .answer__marker { display: none; } } } .question__answer { &.highlight-answer.answer .answer__marker__inner { opacity: 1; background: color(brightness-7); } &.highlight-answer.answer .answer__marker { border: 1px solid color(brightness-7); } } .question.answered .answer__wrapper { background: color(brightness-93); } } } } //labs personality quizzes .garnett--type-guardianlabs { .element-atom { .quiz { &.personality-quiz { .question__wrapper .question__text { font-family: $guardian-sans; font-weight: 700; font-size: 18px; line-height: 21px; &::before { content: counter(question-counter); font: 50px/1 $guardian-sans; left: 0; position: absolute; top: 3px; width: 60px; } } .question__answer .answer__text { font-family: $guardian-sans; font-weight: 400; font-size: 16px; line-height: 20px; } .question__answer { &.highlight-answer.answer .answer__wrapper, &.highlight-answer.answer.has-image { font-family: $guardian-sans; font-size: 16px; line-height: 20px; background-color: color(brightness-86); } } .question.answered .answer__wrapper { background: color(brightness-93); } } } } }