From 69ea201ddc2e9d1c21d0a847b75ccb86cd5a3d7e Mon Sep 17 00:00:00 2001 From: IlyaDoronin Date: Mon, 4 Mar 2024 19:40:53 +0300 Subject: [PATCH] feat: design logic --- lib/components/ViewPublicationPage/Footer.tsx | 52 +- .../ViewPublicationPage/Question.tsx | 71 +- .../StartPageViewPublication/index.tsx | 28 +- .../ViewPublicationPage.tsx | 11 +- .../ViewPublicationPage/questions/Date.tsx | 170 ++-- .../ViewPublicationPage/questions/File.tsx | 2 +- .../ViewPublicationPage/questions/Number.tsx | 819 +++++++++--------- .../ViewPublicationPage/questions/Text.tsx | 407 +++++---- .../ViewPublicationPage/questions/Variant.tsx | 476 +++++----- .../ViewPublicationPage/questions/Varimg.tsx | 349 ++++---- .../ViewPublicationPage/tools/Select.tsx | 5 +- lib/model/settingsData.ts | 26 +- lib/ui_kit/Stepper.tsx | 37 + .../themes/Publication/themePublication.ts | 594 +++++++++---- 14 files changed, 1719 insertions(+), 1328 deletions(-) create mode 100644 lib/ui_kit/Stepper.tsx diff --git a/lib/components/ViewPublicationPage/Footer.tsx b/lib/components/ViewPublicationPage/Footer.tsx index 874b75d..abe894a 100644 --- a/lib/components/ViewPublicationPage/Footer.tsx +++ b/lib/components/ViewPublicationPage/Footer.tsx @@ -1,6 +1,9 @@ -import { useQuizData } from "@contexts/QuizDataContext"; -import { Box, Typography, useTheme } from "@mui/material"; import { ReactNode } from "react"; +import { Box, Typography, useTheme } from "@mui/material"; + +import { useQuizData } from "@contexts/QuizDataContext"; + +import Stepper from "@ui_kit/Stepper"; type FooterProps = { stepNumber: number | null; @@ -10,8 +13,10 @@ type FooterProps = { export const Footer = ({ stepNumber, nextButton, prevButton }: FooterProps) => { const theme = useTheme(); - const { questions } = useQuizData(); - console.log(questions); + const { questions, settings } = useQuizData(); + const questionsAmount = questions.filter( + ({ type }) => type !== "result" + ).length; return ( { borderTop: `1px solid ${theme.palette.grey[400]}`, height: "75px", display: "flex", + background: settings.cfg.design + ? "rgba(154,154,175, 0.2)" + : "transparent", }} > { {/* */} {/*)}*/} {stepNumber !== null && ( - - Шаг - - {stepNumber} - - Из - - {questions.filter((q) => q.type !== "result").length} + + + Вопрос {stepNumber} из {questionsAmount} + )} diff --git a/lib/components/ViewPublicationPage/Question.tsx b/lib/components/ViewPublicationPage/Question.tsx index e742a98..1fa6caf 100644 --- a/lib/components/ViewPublicationPage/Question.tsx +++ b/lib/components/ViewPublicationPage/Question.tsx @@ -33,7 +33,7 @@ import Desgin9 from "@icons/designs/design9.jpg"; import Desgin10 from "@icons/designs/design10.jpg"; import type { ReactNode } from "react"; -import type { Design } from "@model/settingsData"; +import type { QuizTheme } from "@model/settingsData"; type Props = { currentQuestion: RealTypedQuizQuestion; @@ -42,18 +42,28 @@ type Props = { prevButton: ReactNode; }; -export const DESIGN_LIST: Record = { - "": "", - design1: Desgin1, - design2: Desgin2, - design3: Desgin3, - design4: Desgin4, - design5: Desgin5, - design6: Desgin6, - design7: Desgin7, - design8: Desgin8, - design9: Desgin9, - design10: Desgin10, +export const DESIGN_LIST: Record = { + Design1: Desgin1, + Design2: Desgin2, + Design3: Desgin3, + Design4: Desgin4, + Design5: Desgin5, + Design6: Desgin6, + Design7: Desgin7, + Design8: Desgin8, + Design9: Desgin9, + Design10: Desgin10, + StandardTheme: "", + StandardDarkTheme: "", + PinkTheme: "", + PinkDarkTheme: "", + BlackWhiteTheme: "", + OliveTheme: "", + YellowTheme: "", + GoldDarkTheme: "", + PurpleTheme: "", + BlueTheme: "", + BlueDarkTheme: "", }; export const Question = ({ @@ -64,19 +74,20 @@ export const Question = ({ }: Props) => { const theme = useTheme(); const { settings } = useQuizData(); - const design = DESIGN_LIST[settings.cfg.design]; return ( - {quizThemes[settings.cfg.theme].isLight ? ( - - - - ) : ( - - - - )} + + {quizThemes[settings.cfg.theme].isLight ? ( + + + + ) : ( + + + + )} +