feat: StartPageSettings mobile styles
This commit is contained in:
parent
b9b3644ac3
commit
5b21df276d
@ -9,6 +9,7 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { ChangeEvent, useState } from "react";
|
import { ChangeEvent, useState } from "react";
|
||||||
@ -59,15 +60,17 @@ type BackgroundType = "image" | "video";
|
|||||||
type AlignType = "left" | "right" | "center";
|
type AlignType = "left" | "right" | "center";
|
||||||
|
|
||||||
export default function StartPageSettings() {
|
export default function StartPageSettings() {
|
||||||
|
const [alignType, setAlignType] = useState<AlignType>("left");
|
||||||
|
const [formState, setFormState] = useState<"design" | "content">("design");
|
||||||
const { listQuizes, updateQuizesList, removeQuiz, createBlank } = quizStore();
|
const { listQuizes, updateQuizesList, removeQuiz, createBlank } = quizStore();
|
||||||
const params = Number(useParams().quizId);
|
const params = Number(useParams().quizId);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const designType = listQuizes[params].startpage;
|
const designType = listQuizes[params].startpage;
|
||||||
const StartPageClone = listQuizes[params];
|
|
||||||
const [backgroundType, setBackgroundType] = useState(
|
const [backgroundType, setBackgroundType] = useState(
|
||||||
listQuizes[params].config.startpage.background.type
|
listQuizes[params].config.startpage.background.type
|
||||||
);
|
);
|
||||||
const [alignType, setAlignType] = useState<AlignType>("left");
|
const isSmallMonitor = useMediaQuery(theme.breakpoints.down(1500));
|
||||||
|
const isTablet = useMediaQuery(theme.breakpoints.down(950));
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = () => {
|
||||||
updateQuizesList(params, { step: listQuizes[params].step + 1 });
|
updateQuizesList(params, { step: listQuizes[params].step + 1 });
|
||||||
@ -132,17 +135,54 @@ export default function StartPageSettings() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Typography variant="h5" sx={{ marginTop: "60px" }}>
|
<Typography
|
||||||
|
variant="h5"
|
||||||
|
sx={{ marginTop: "60px", marginBottom: isSmallMonitor ? "0" : "40px" }}
|
||||||
|
>
|
||||||
Стартовая страница
|
Стартовая страница
|
||||||
</Typography>
|
</Typography>
|
||||||
|
{isSmallMonitor && (
|
||||||
|
<Box sx={{ display: "flex", gap: "5px", margin: "20px 0px 10px" }}>
|
||||||
|
<Button onClick={() => setFormState("design")}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontWeight: 500,
|
||||||
|
fontSize: "16px",
|
||||||
|
color: formState === "design" ? "#7E2AEA" : "#7D7E86",
|
||||||
|
borderBottom:
|
||||||
|
formState === "design"
|
||||||
|
? "2px solid #7E2AEA"
|
||||||
|
: "1px solid transparent",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Дизайн
|
||||||
|
</Typography>
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => setFormState("content")}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontWeight: 500,
|
||||||
|
fontSize: "16px",
|
||||||
|
color: formState === "content" ? "#7E2AEA" : "#7D7E86",
|
||||||
|
borderBottom:
|
||||||
|
formState === "content"
|
||||||
|
? "2px solid #7E2AEA"
|
||||||
|
: "1px solid transparent",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Контент
|
||||||
|
</Typography>
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
boxSizing: "border-box",
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
p: "20px",
|
p: "20px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
gap: "20px",
|
gap: "20px",
|
||||||
marginTop: "40px",
|
|
||||||
maxWidth: "1160px",
|
maxWidth: "1160px",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24),
|
boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24),
|
||||||
@ -153,10 +193,13 @@ export default function StartPageSettings() {
|
|||||||
0px 2.76726px 8.55082px rgba(210, 208, 225, 0.0674749)`,
|
0px 2.76726px 8.55082px rgba(210, 208, 225, 0.0674749)`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{(!isSmallMonitor || (isSmallMonitor && formState === "design")) && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
pr: "20px",
|
pr: "20px",
|
||||||
borderRight: `1px solid ${theme.palette.grey2.main}`,
|
borderRight: `1px solid ${
|
||||||
|
isTablet ? "transparent" : theme.palette.grey2.main
|
||||||
|
}`,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
flex: `1 1 342px`,
|
flex: `1 1 342px`,
|
||||||
@ -314,7 +357,11 @@ export default function StartPageSettings() {
|
|||||||
>
|
>
|
||||||
Изображение
|
Изображение
|
||||||
</Typography>
|
</Typography>
|
||||||
<DropZone text={"5 MB максимум"} heightImg={"110px"} />
|
<DropZone
|
||||||
|
text={"5 MB максимум"}
|
||||||
|
heightImg={"110px"}
|
||||||
|
sx={{ maxWidth: "300px" }}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<ModalSizeImage />
|
<ModalSizeImage />
|
||||||
@ -392,7 +439,10 @@ export default function StartPageSettings() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Box>
|
</Box>
|
||||||
<ButtonBase component="label" sx={{ justifyContent: "flex-start" }}>
|
<ButtonBase
|
||||||
|
component="label"
|
||||||
|
sx={{ justifyContent: "flex-start" }}
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
onChange={(event) => videoHC(event.target)}
|
onChange={(event) => videoHC(event.target)}
|
||||||
hidden
|
hidden
|
||||||
@ -491,6 +541,8 @@ export default function StartPageSettings() {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{(isTablet || !isSmallMonitor) && (
|
||||||
|
<>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: backgroundType === "image" ? "flex" : "none",
|
display: backgroundType === "image" ? "flex" : "none",
|
||||||
@ -506,7 +558,11 @@ export default function StartPageSettings() {
|
|||||||
>
|
>
|
||||||
Логотип
|
Логотип
|
||||||
</Typography>
|
</Typography>
|
||||||
<DropZone text={"5 MB максимум"} heightImg={"110px"} />
|
<DropZone
|
||||||
|
text={"5 MB максимум"}
|
||||||
|
heightImg={"110px"}
|
||||||
|
sx={{ maxWidth: "300px" }}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Typography
|
<Typography
|
||||||
@ -543,15 +599,80 @@ export default function StartPageSettings() {
|
|||||||
5 MB максимум
|
5 MB максимум
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
{/*Правая сторона*/}
|
{/*Правая сторона*/}
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: isTablet && formState === "design" ? "none" : "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
flex: `1 1 795px`,
|
flex: `1 1 795px`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{!isTablet && isSmallMonitor && formState === "design" && (
|
||||||
|
<>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: backgroundType === "image" ? "flex" : "none",
|
||||||
|
flexDirection: "column",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontWeight: 500,
|
||||||
|
color: theme.palette.grey3.main,
|
||||||
|
margin: "20px 0",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Логотип
|
||||||
|
</Typography>
|
||||||
|
<DropZone
|
||||||
|
text={"5 MB максимум"}
|
||||||
|
heightImg={"110px"}
|
||||||
|
sx={{ maxWidth: "300px" }}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontWeight: 500,
|
||||||
|
color: theme.palette.grey3.main,
|
||||||
|
mt: "20px",
|
||||||
|
mb: "14px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Favicon
|
||||||
|
</Typography>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "end",
|
||||||
|
gap: "10px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DropFav
|
||||||
|
sx={{ height: "48px", width: "48px" }}
|
||||||
|
heightImg={"48px"}
|
||||||
|
widthImg={"48px"}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
color: theme.palette.orange.main,
|
||||||
|
fontSize: "16px",
|
||||||
|
lineHeight: "19px",
|
||||||
|
textDecoration: "underline",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
5 MB максимум
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{(!isSmallMonitor || (isSmallMonitor && formState === "content")) && (
|
||||||
|
<>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
@ -564,7 +685,9 @@ export default function StartPageSettings() {
|
|||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="Текст-заполнитель — это текст, который"
|
placeholder="Текст-заполнитель — это текст, который"
|
||||||
text={listQuizes[params].name}
|
text={listQuizes[params].name}
|
||||||
onChange={(e) => updateQuizesList(params, { name: e.target.value })}
|
onChange={(e) =>
|
||||||
|
updateQuizesList(params, { name: e.target.value })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@ -666,6 +789,8 @@ export default function StartPageSettings() {
|
|||||||
onChange={mutationLawHC}
|
onChange={mutationLawHC}
|
||||||
/>
|
/>
|
||||||
<Extra />
|
<Extra />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user