feat: create form logic
This commit is contained in:
parent
a5f3fc5cff
commit
0573316cfc
@ -12,6 +12,7 @@ import {
|
|||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
import BackArrowIcon from "@icons/BackArrowIcon";
|
import BackArrowIcon from "@icons/BackArrowIcon";
|
||||||
import NavMenuItem from "@ui_kit/Header/NavMenuItem";
|
import NavMenuItem from "@ui_kit/Header/NavMenuItem";
|
||||||
import EyeIcon from "@icons/EyeIcon";
|
import EyeIcon from "@icons/EyeIcon";
|
||||||
@ -64,11 +65,13 @@ export default function StartPage() {
|
|||||||
zIndex: theme.zIndex.drawer + 1,
|
zIndex: theme.zIndex.drawer + 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isMobile ? (
|
<Link to="/" style={{ display: "flex" }}>
|
||||||
<PenaLogoIcon style={{ fontSize: "39px", color: "white" }} />
|
{isMobile ? (
|
||||||
) : (
|
<PenaLogoIcon style={{ fontSize: "39px", color: "white" }} />
|
||||||
<PenaLogo width={124} />
|
) : (
|
||||||
)}
|
<PenaLogo width={124} />
|
||||||
|
)}
|
||||||
|
</Link>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: isMobile ? "none" : "flex",
|
display: isMobile ? "none" : "flex",
|
||||||
|
|||||||
@ -2,15 +2,15 @@ import { Box, Button, Typography, useTheme } from "@mui/material";
|
|||||||
import CreationCard from "@ui_kit/CreationCard";
|
import CreationCard from "@ui_kit/CreationCard";
|
||||||
import quizCreationImage1 from "../../assets/quiz-creation-1.png";
|
import quizCreationImage1 from "../../assets/quiz-creation-1.png";
|
||||||
import quizCreationImage2 from "../../assets/quiz-creation-2.png";
|
import quizCreationImage2 from "../../assets/quiz-creation-2.png";
|
||||||
import {useParams} from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import {quizStore} from "@root/quizes";
|
import { quizStore } from "@root/quizes";
|
||||||
|
|
||||||
export default function StepOne() {
|
export default function StepOne() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const params = Number(useParams().quizId);
|
const params = Number(useParams().quizId);
|
||||||
|
|
||||||
const {listQuizes, updateQuizesList,} = quizStore()
|
const { listQuizes, updateQuizesList } = quizStore();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box
|
<Box
|
||||||
@ -20,30 +20,45 @@ export default function StepOne() {
|
|||||||
mt: "60px",
|
mt: "60px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button variant="text" onClick={() => {
|
<Button
|
||||||
let SPageClone = listQuizes[params].config
|
variant="text"
|
||||||
SPageClone.type = "quize"
|
onClick={() => {
|
||||||
updateQuizesList(params, {config: SPageClone })
|
let SPageClone = listQuizes[params].config;
|
||||||
}
|
SPageClone.type = "quize";
|
||||||
}>
|
updateQuizesList(params, { config: SPageClone });
|
||||||
|
}}
|
||||||
|
>
|
||||||
<CreationCard
|
<CreationCard
|
||||||
header="Создание квиз-опроса"
|
header="Создание квиз-опроса"
|
||||||
text="У стартовой страницы одна ключевая задача - заинтересовать посетителя пройти квиз. С ней сложно ошибиться, сформулируйте суть предложения и подберите живую фотографию, остальное мы сделаем за вас"
|
text="У стартовой страницы одна ключевая задача - заинтересовать посетителя пройти квиз. С ней сложно ошибиться, сформулируйте суть предложения и подберите живую фотографию, остальное мы сделаем за вас"
|
||||||
image={quizCreationImage1}
|
image={quizCreationImage1}
|
||||||
border={listQuizes[params].config.type === "quize" ? "1px solid #7E2AEA" : "none"}
|
border={
|
||||||
|
listQuizes[params].config.type === "quize"
|
||||||
|
? "1px solid #7E2AEA"
|
||||||
|
: "none"
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="text" onClick={() => {
|
<Button
|
||||||
let SPageClone = listQuizes[params].config
|
variant="text"
|
||||||
SPageClone.type = "form"
|
onClick={() => {
|
||||||
updateQuizesList(params, {config: SPageClone })
|
let SPageClone = listQuizes[params].config;
|
||||||
}
|
SPageClone.type = "form";
|
||||||
}>
|
updateQuizesList(params, {
|
||||||
|
config: SPageClone,
|
||||||
|
step: listQuizes[params].step + 1,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
<CreationCard
|
<CreationCard
|
||||||
header="Создание анкеты"
|
header="Создание анкеты"
|
||||||
text="У стартовой страницы одна ключевая задача - заинтересовать посетителя пройти квиз. С ней сложно ошибиться, сформулируйте суть предложения и подберите живую фотографию, остальное мы сделаем за вас"
|
text="У стартовой страницы одна ключевая задача - заинтересовать посетителя пройти квиз. С ней сложно ошибиться, сформулируйте суть предложения и подберите живую фотографию, остальное мы сделаем за вас"
|
||||||
image={quizCreationImage2}
|
image={quizCreationImage2}
|
||||||
border={listQuizes[params].config.type === "form" ? "1px solid #7E2AEA" : "none"}
|
border={
|
||||||
|
listQuizes[params].config.type === "form"
|
||||||
|
? "1px solid #7E2AEA"
|
||||||
|
: "none"
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export default function SwitchStepPages({
|
|||||||
if (!startpage) return <Steptwo />;
|
if (!startpage) return <Steptwo />;
|
||||||
return <StartPageSettings />;
|
return <StartPageSettings />;
|
||||||
case 2:
|
case 2:
|
||||||
|
if (quizType === "form") return <QuestionsPage />;
|
||||||
return <QuestionsPage />;
|
return <QuestionsPage />;
|
||||||
case 3:
|
case 3:
|
||||||
if (!createResult) return <Result />;
|
if (!createResult) return <Result />;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user