♻️(demo) refactor Onboarding modal display
Here is a shorter way to achieve the same result as before.
This commit is contained in:
@@ -2,15 +2,15 @@ import React from "react";
|
||||
import { Button, Modal, ModalSize, useModal } from "@openfun/cunningham-react";
|
||||
|
||||
const Onboarding = () => {
|
||||
const modal = useModal({ isOpenDefault: true });
|
||||
const modal = useModal({
|
||||
isOpenDefault: !sessionStorage.getItem("onboarded"),
|
||||
});
|
||||
|
||||
const handleClose = () => {
|
||||
sessionStorage.setItem("onboarded", "1");
|
||||
modal.close();
|
||||
};
|
||||
|
||||
if (sessionStorage.getItem("onboarded")) return null;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
size={ModalSize.MEDIUM}
|
||||
|
||||
Reference in New Issue
Block a user