Skip to content

Commit

Permalink
Merge pull request #741 from sailaja-adapa/toastify
Browse files Browse the repository at this point in the history
Added Toastify Message
  • Loading branch information
panwar8279 authored Jun 12, 2024
2 parents 15e5fcb + e48a172 commit a0e082c
Showing 1 changed file with 38 additions and 24 deletions.
62 changes: 38 additions & 24 deletions frontend/src/Component/Rateus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { useState } from "react";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import "./../style/Rateus.css";

function RateUsComponent({ previousContent }) {
Expand All @@ -19,35 +21,47 @@ function RateUsComponent({ previousContent }) {
// Reset the state after submitting
setRating(0);
setFeedback("");
}
// Show toast message
toast.success("Thanks For Your Feedback :)", {
position: "top-center"
});
} else {
toast.error("Please Enter All Details :(", {
position: "top-center"
});
}
};

return (
<div className="rate-us-page">
<div className="rate-us-container">
<h2 className="rate-us-heading">Rate Our Website</h2>
<div className="star-rating">
{[1, 2, 3, 4, 5].map((star) => (
<span
key={star}
className={star <= rating ? "star filled" : "star"}
onClick={() => handleStarClick(star)}
>
</span>
))}
<>
<div className="rate-us-page">
<div className="rate-us-container">
<h2 className="rate-us-heading">Rate Our Website</h2>
<div className="star-rating">
{[1, 2, 3, 4, 5].map((star) => (
<span
key={star}
className={star <= rating ? "star filled" : "star"}
onClick={() => handleStarClick(star)}
>
</span>
))}
</div>
<textarea
className="feedback-textarea"
placeholder="Write your feedback here..."
value={feedback}
onChange={handleFeedbackChange}
></textarea>
<button className="submit-button" onClick={handleSubmit}>
Submit
</button>
</div>
<textarea
className="feedback-textarea"
placeholder="Write your feedback here..."
value={feedback}
onChange={handleFeedbackChange}
></textarea>
<button className="submit-button" onClick={handleSubmit}>
Submit
</button>
</div>
</div>
<ToastContainer />
</>
);
}

export default RateUsComponent;

0 comments on commit a0e082c

Please sign in to comment.