front-hub/src/components/FloatingSupportChat/FloatingSupportChat.tsx

44 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-04-19 13:45:33 +00:00
import { Box, Fab } from "@mui/material";
2023-04-13 16:48:17 +00:00
import { useState } from "react";
2023-04-19 13:45:33 +00:00
import CircleDoubleDown from "./CircleDoubleDownIcon";
2023-04-13 16:48:17 +00:00
import Chat from "./Chat";
export default function FloatingSupportChat() {
const [isChatOpened, setIsChatOpened] = useState<boolean>(false);
return (
<Box sx={{
position: "fixed",
right: "20px",
bottom: "10px",
display: "flex",
2023-05-10 19:43:14 +00:00
flexDirection: "column",
gap: "8px",
width: "clamp(200px, 100% - 40px, 454px)",
2023-05-03 10:35:20 +00:00
zIndex: 10,
2023-04-13 16:48:17 +00:00
}}>
2023-05-03 09:54:04 +00:00
{isChatOpened &&
<Chat sx={{
2023-05-10 19:43:14 +00:00
alignSelf: "start",
width: "clamp(200px, 100%, 400px)",
2023-05-03 09:54:04 +00:00
}} />
}
2023-04-13 16:48:17 +00:00
<Fab
variant={"extended"}
onClick={() => setIsChatOpened(prev => !prev)}
sx={{
pl: "11px",
pr: !isChatOpened ? "15px" : "11px",
gap: "11px",
height: "54px",
borderRadius: "27px",
alignSelf: "end",
}}
>
<CircleDoubleDown isUp={isChatOpened} />
{!isChatOpened && "Задайте нам вопрос"}
</Fab>
</Box>
);
}