diff --git a/assets/styles/quiz.scss b/assets/styles/quiz.scss index 3c4e3be..446cae0 100644 --- a/assets/styles/quiz.scss +++ b/assets/styles/quiz.scss @@ -17,7 +17,72 @@ body { background-color: black; display: grid; align-content: center; - justify-self: center; +} + +.quiz-form-narrow { + max-width: 320px; + width: 100%; + margin: 0 auto; +} + +.quiz-content { + width: fit-content; + max-width: min(760px, 100%); + margin: 0 auto; +} + +.quiz-answers-grid { + display: grid; + grid-template-columns: repeat(2, auto); + column-gap: 2rem; + + @media (max-width: 767px) { + grid-template-columns: 1fr; + } +} + +.answer-btn { + display: flex; + align-items: center; + gap: 0.8rem; + background: transparent; + border: none; + color: white; + font-size: 1.1rem; + padding: 0.4rem 0; + cursor: pointer; + text-align: left; + line-height: 1.3; + + &::before { + content: ''; + display: block; + flex-shrink: 0; + width: 2rem; + height: 2rem; + background: radial-gradient(ellipse at 35% 30%, #6abf4b, #2d7a1f); + border-radius: 4px; + box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.6); + } + + &:hover, + &:focus { + color: #7ed45a; + outline: none; + + &::before { + background: radial-gradient(ellipse at 35% 30%, #86d45f, #3d9c2a); + } + } +} + +input.btn-check:checked + label.answer-btn { + color: #7ed45a; + + &::before { + background: radial-gradient(ellipse at 35% 30%, #86d45f, #3d9c2a); + box-shadow: 0 0 10px rgba(106, 191, 75, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.3); + } } .elimination-screen { diff --git a/templates/quiz/enter_name.twig b/templates/quiz/enter_name.twig index bc91c82..78a41ea 100644 --- a/templates/quiz/enter_name.twig +++ b/templates/quiz/enter_name.twig @@ -1,4 +1,6 @@ {% extends 'quiz/base.html.twig' %} {% block body %} - {{ form(form) }} +
+ {{ form(form) }} +
{% endblock body %} diff --git a/templates/quiz/question.twig b/templates/quiz/question.twig index 8c200c3..c2e616b 100644 --- a/templates/quiz/question.twig +++ b/templates/quiz/question.twig @@ -1,36 +1,43 @@ {% extends 'quiz/base.html.twig' %} {% block body %} -

- {% if season.settings.showNumbers %} - ({{ question.ordering }}/{{ question.quiz.questions.count }}) - {% endif %}{{ question.question }}
-

-
- - {% if season.settings.confirmAnswers == false %} - {% for answer in question.answers %} +
+

+ {% if season.settings.showNumbers %} + ({{ question.ordering }}/{{ question.quiz.questions.count }}) + {% endif %}{{ question.question }}
+

+ + + {% set twoCol = question.answers|length >= 6 %} + {% if season.settings.confirmAnswers == false %} +
+ {% for answer in question.answers %} +
+ +
+ {% endfor %} +
+ {% else %} +
+ {% for answer in question.answers %} +
+ + +
+ {% endfor %} +
- + >{{ 'Next'|trans }}
- {% endfor %} - {% else %} - {% for answer in question.answers %} -
- - -
- {% endfor %} -
- -
- {% endif %} - + {% endif %} + +
{% endblock body %} diff --git a/templates/quiz/select_season.html.twig b/templates/quiz/select_season.html.twig index d1c0e48..85029ad 100644 --- a/templates/quiz/select_season.html.twig +++ b/templates/quiz/select_season.html.twig @@ -1,5 +1,7 @@ {% extends 'quiz/base.html.twig' %} {% block body %} - {{ form(form) }} - {{ 'Manage Quiz'|trans }} +
+ {{ form(form) }} + {{ 'Manage Quiz'|trans }} +
{% endblock body %} diff --git a/tests/Service/QuizSpreadsheetServiceTest.php b/tests/Service/QuizSpreadsheetServiceTest.php index e5c7fc7..8f504c5 100644 --- a/tests/Service/QuizSpreadsheetServiceTest.php +++ b/tests/Service/QuizSpreadsheetServiceTest.php @@ -127,6 +127,7 @@ final class QuizSpreadsheetServiceTest extends TestCase $question = new Question(); $question->question = 'Unanswered question'; $question->ordering = 1; + $quiz->addQuestion($question); $path = $this->captureXlsx($this->subject->quizToXlsx($quiz)); @@ -134,8 +135,8 @@ final class QuizSpreadsheetServiceTest extends TestCase try { $this->subject->xlsxToQuiz(new Quiz(), new File($path)); $this->fail('Expected SpreadsheetDataException to be thrown'); - } catch (SpreadsheetDataException $e) { - $this->assertNotEmpty($e->errors); + } catch (SpreadsheetDataException $spreadsheetDataException) { + $this->assertNotEmpty($spreadsheetDataException->errors); } }