fix: buttons and other styles

This commit is contained in:
IlyaDoronin 2023-08-15 12:51:18 +03:00
parent 1d5166075e
commit f3e2f23a35

@ -1,4 +1,11 @@
import { Box, Button, ButtonBase, Modal, Typography, useTheme } from "@mui/material"; import {
Box,
Button,
ButtonBase,
Modal,
Typography,
useTheme,
} from "@mui/material";
import * as React from "react"; import * as React from "react";
import SelectableButton from "@ui_kit/SelectableButton"; import SelectableButton from "@ui_kit/SelectableButton";
import CustomTextField from "@ui_kit/CustomTextField"; import CustomTextField from "@ui_kit/CustomTextField";
@ -14,7 +21,8 @@ export default function HelpQuestions() {
const handleOpen = () => setOpen(true); const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false); const handleClose = () => setOpen(false);
const [backgroundType, setBackgroundType] = useState<BackgroundType>("text"); const [backgroundType, setBackgroundType] = useState<BackgroundType>("text");
const [backgroundTypeModal, setBackgroundTypeModal] = useState<BackgroundTypeModal>("linkVideo"); const [backgroundTypeModal, setBackgroundTypeModal] =
useState<BackgroundTypeModal>("linkVideo");
const theme = useTheme(); const theme = useTheme();
const videoHC = (videoInp: HTMLInputElement) => { const videoHC = (videoInp: HTMLInputElement) => {
@ -28,18 +36,33 @@ export default function HelpQuestions() {
const [video, setVideo] = React.useState(""); const [video, setVideo] = React.useState("");
return ( return (
<Box sx={{ padding: "20px", display: "flex", flexDirection: "column", gap: "20px" }}> <Box
<Typography>Подсказка консультанта</Typography> sx={{
padding: "20px",
display: "flex",
flexDirection: "column",
gap: "20px",
}}
>
<Typography sx={{ fontWeight: "500" }}>Подсказка консультанта</Typography>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
gap: "10px", gap: "10px",
}} }}
> >
<SelectableButton isSelected={backgroundType === "text"} onClick={() => setBackgroundType("text")}> <SelectableButton
isSelected={backgroundType === "text"}
onClick={() => setBackgroundType("text")}
sx={{ maxWidth: "130px" }}
>
Текст Текст
</SelectableButton> </SelectableButton>
<SelectableButton isSelected={backgroundType === "video"} onClick={() => setBackgroundType("video")}> <SelectableButton
isSelected={backgroundType === "video"}
onClick={() => setBackgroundType("video")}
sx={{ maxWidth: "130px" }}
>
Видео Видео
</SelectableButton> </SelectableButton>
</Box> </Box>
@ -49,8 +72,13 @@ export default function HelpQuestions() {
</> </>
) : ( ) : (
<Box> <Box>
<Typography sx={{ paddingBottom: "15px" }}>Загрузите видео</Typography> <Typography sx={{ paddingBottom: "15px", fontWeight: "500" }}>
<ButtonBase onClick={handleOpen} sx={{ justifyContent: "flex-start" }}> Загрузите видео
</Typography>
<ButtonBase
onClick={handleOpen}
sx={{ justifyContent: "flex-start" }}
>
{video ? ( {video ? (
<video src={video} width="400" controls /> <video src={video} width="400" controls />
) : ( ) : (
@ -91,8 +119,9 @@ export default function HelpQuestions() {
background: theme.palette.background.default, background: theme.palette.background.default,
}} }}
> >
<Typography> <Typography sx={{ color: "#9A9AAF" }}>
Видео можно вставить с любого хостинга: YouTube, Vimeo или загрузить собственное Видео можно вставить с любого хостинга: YouTube, Vimeo или
загрузить собственное
</Typography> </Typography>
<Button variant="contained">Готово</Button> <Button variant="contained">Готово</Button>
</Box> </Box>
@ -100,42 +129,64 @@ export default function HelpQuestions() {
<SelectableButton <SelectableButton
isSelected={backgroundTypeModal === "linkVideo"} isSelected={backgroundTypeModal === "linkVideo"}
onClick={() => setBackgroundTypeModal("linkVideo")} onClick={() => setBackgroundTypeModal("linkVideo")}
sx={{ maxWidth: "170px", padding: "10px" }}
> >
Ссылка на видео Ссылка на видео
</SelectableButton> </SelectableButton>
<SelectableButton <SelectableButton
isSelected={backgroundTypeModal === "ownVideo"} isSelected={backgroundTypeModal === "ownVideo"}
onClick={() => setBackgroundTypeModal("ownVideo")} onClick={() => setBackgroundTypeModal("ownVideo")}
sx={{ maxWidth: "170px", padding: "10px" }}
> >
Загрузить свое Загрузить свое
</SelectableButton> </SelectableButton>
</Box> </Box>
{backgroundTypeModal === "linkVideo" ? ( {backgroundTypeModal === "linkVideo" ? (
<Box sx={{ padding: "20px" }}> <Box sx={{ padding: "20px" }}>
<Typography sx={{ paddingBottom: "15px" }}>Ссылка на видео</Typography> <Typography sx={{ paddingBottom: "15px", fontWeight: "500" }}>
<CustomTextField placeholder={"http://example.com"} text={""} /> Ссылка на видео
</Typography>
<CustomTextField
placeholder={"http://example.com"}
text={""}
/>
</Box> </Box>
) : ( ) : (
<Box sx={{ padding: "20px" }}> <Box sx={{ padding: "20px" }}>
<Typography sx={{ paddingBottom: "15px" }}>Загрузите видео</Typography> <Typography sx={{ paddingBottom: "15px", fontWeight: "500" }}>
<ButtonBase component="label" sx={{ justifyContent: "flex-start" }}> Загрузите видео
<input onChange={(event) => videoHC(event.target)} hidden accept="video/*" multiple type="file" /> </Typography>
<ButtonBase
component="label"
sx={{ justifyContent: "flex-start", width: "100%" }}
>
<input
onChange={(event) => videoHC(event.target)}
hidden
accept="video/*"
multiple
type="file"
/>
<Box <Box
sx={{ sx={{
width: "580px", width: "580px",
padding: "33px", padding: "33px 33px 33px 50px",
display: "flex", display: "flex",
justifyContent: "space-between",
alignItems: "center", alignItems: "center",
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
border: `1px solid ${theme.palette.grey2.main}`, border: `1px solid ${theme.palette.grey2.main}`,
borderRadius: "8px", borderRadius: "8px",
gap: "50px",
}} }}
> >
<UploadIcon /> <UploadIcon />
<Box> <Box sx={{ color: "#9A9AAF" }}>
<Typography>Добавить видео</Typography> <Typography sx={{ fontWeight: "500" }}>
<Typography>Принимает .mp4 и .mov формат максимум 100мб</Typography> Добавить видео
</Typography>
<Typography sx={{ fontSize: "16px" }}>
Принимает .mp4 и .mov формат максимум 100мб
</Typography>
</Box> </Box>
</Box> </Box>
</ButtonBase> </ButtonBase>