Skip to content

Commit

Permalink
manageFaq scss and loader fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SwayamRana808 committed May 21, 2024
1 parent 3c13683 commit bd258e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
29 changes: 11 additions & 18 deletions frontend/src/pages/Admin/Components/Faq/ManageFaq/ManageFaq.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export function ManageFaq(props) {
const [faqs, setFaqs] = useState([]);
const [expanded, setExpanded] = useState(false);
const [isFetching, setIsFetching] = useState(true);
const [loading, setLoading] = useState(false);
const [open, setOpenToast] = useState(false);
const [toastMessage, setToastMessage] = useState("");
const [severity, setSeverity] = useState("success");
Expand All @@ -43,7 +42,7 @@ export function ManageFaq(props) {
}

const deleteFaq = async (faqId) => {
setLoading(true);
setIsFetching(true);
const url = `${END_POINT}/deleteFaq`;
const body = {
userId: props.adminData._id,
Expand Down Expand Up @@ -71,7 +70,7 @@ export function ManageFaq(props) {
setOpenToast(true);
setSeverity("error");
} finally {
setLoading(false);
setIsFetching(false);
}
};
useEffect(() => {
Expand Down Expand Up @@ -133,21 +132,15 @@ export function ManageFaq(props) {
>
UPDATE
</Button>
{loading ? (
<div className={style["data-loader"]}>
<Loader />
</div>
) : (
<Button
id={style["delete-btn"]}
className={style["btns"]}
variant="contained"
endIcon={<Delete />}
onClick={() => deleteFaq(faq._id)}
>
DELETE
</Button>
)}
<Button
id={style["delete-btn"]}
className={style["btns"]}
variant="contained"
endIcon={<Delete />}
onClick={() => deleteFaq(faq._id)}
>
DELETE
</Button>
</div>
</AccordionDetails>
</Accordion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
background: linear-gradient(45deg, #4e4376 0%, #2b5876 90%);
margin: 12px 0;
border-radius: 10;

&:hover {
background: linear-gradient(
45deg,
rgba(255, 0, 90, 1) 0%,
rgba(10, 24, 61, 1) 90%
);
transition: all 0.3s ease-in-out;
}
}

.btns-container {
Expand All @@ -69,11 +78,3 @@
display: flex;
flex-direction: column;
}
.data-loader {
width: fit-content;
padding: 19px;
display: inline-flex;
height: 30px;
justify-content: center;
align-items: center;
}

0 comments on commit bd258e1

Please sign in to comment.