Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Toastify Message #741

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading