Created the Question.jsx

This commit is contained in:
Mathias Wagner 2023-07-08 02:16:13 +02:00
parent 69c8106f64
commit ba2c5ed009
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -0,0 +1,20 @@
import {Collapse, Stack, Typography} from "@mui/material";
import {ExpandMore} from "@mui/icons-material";
import {useState} from "react";
export const Question = ({question, answer}) => {
const [open, setOpen] = useState(false);
return (
<Stack direction="column" sx={{border: "1px solid #E0E0E0", borderRadius: 2, p: 2}}>
<Stack direction="row" justifyContent="space-between" alignItems="center" onClick={() => setOpen(!open)}
sx={{cursor: "pointer"}}>
<Typography variant="h5" fontWeight={700} color="black">{question}?</Typography>
<ExpandMore sx={{transform: open ? "rotate(180deg)" : "rotate(0deg)", transition: "0.3s"}}/>
</Stack>
<Collapse in={open}>
<Typography variant="body1" fontWeight={500} color="black">{answer}</Typography>
</Collapse>
</Stack>
);
}