Skip to content

Commit

Permalink
refactor: Lazy load Confetti component in FeedbackModal
Browse files Browse the repository at this point in the history
  • Loading branch information
jnaraujo committed Aug 4, 2024
1 parent 948defb commit 1209257
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/FeedbackWidget/FeedbackModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from "react";
import Confetti from "react-confetti";
import { useForm } from "react-hook-form";
import { useWindowSize } from "react-use";
import { toast } from "react-hot-toast";
Expand All @@ -15,6 +14,9 @@ import { sendFeedback } from "./helper";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import dynamic from "next/dynamic";

const Confetti = dynamic(() => import("react-confetti"));

type Props = {
children: React.ReactNode;
Expand All @@ -39,8 +41,8 @@ const FeedbackModal: React.FC<Props> = ({ children }) => {
position: "top-center",
});

reset();
setOpen(false);
reset();

setConfetti(true);
setTimeout(() => {
Expand Down

0 comments on commit 1209257

Please sign in to comment.