Skip to content

Commit

Permalink
Merge pull request #990 from AkhilaSunesh/feed
Browse files Browse the repository at this point in the history
Feedback type
  • Loading branch information
panwar8279 committed Jun 20, 2024
2 parents 5d0beff + 3dbf256 commit 265ede3
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion frontend/src/Component/Review.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ function Review() {
name: "",
email: "",
review: "",
feedbackType: "",
otherFeedback: ""
});
const [processingMail, setProcessingMail] = useState(false);

const onChangeHandler = (event) => {
setReviewData({ ...reviewData, [event.target.id]: event.target.value });
};

const onFeedbackTypeChange = (event) => {
setReviewData({ ...reviewData, feedbackType: event.target.value, otherFeedback: "" });
};

const onSubmitHandler = async (event) => {
event.preventDefault();

Expand Down Expand Up @@ -59,7 +65,7 @@ function Review() {
<h2 className='form-header'>Here's the Review Form</h2>
<div>
<p className='form-subtext'>
Thank you for visiting the website! Please tell us how can we improve
Thank you for visiting the website! Please tell us how we can improve
your experience. Provide your email in case you want the owner to
contact you.
</p>
Expand All @@ -83,6 +89,33 @@ function Review() {
onChange={onChangeHandler}
required
/>
<div className='form-input-field' style={{ align: 'Left', display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
<label htmlFor='feedbackType' style={{ marginBottom: '10px' }}>Feedback Type:</label>
<select
id='feedbackType'
value={reviewData.feedbackType}
onChange={onFeedbackTypeChange}
style={{ width: '100%' }}
required
>
<option value=''>Select feedback type</option>
<option value='complaint'>Complaint</option>
<option value='suggestion'>Suggestion</option>
<option value='question'>Question</option>
<option value='other'>Other</option>
</select>
</div>
{reviewData.feedbackType === 'other' && (
<input
className='form-input-field'
placeholder='Please specify'
type='text'
id='otherFeedback'
value={reviewData.otherFeedback}
onChange={onChangeHandler}
required
/>
)}
<textarea
className='form-input-field input-review'
placeholder='Your Message'
Expand All @@ -93,6 +126,7 @@ function Review() {
onChange={onChangeHandler}
required
/>

<h3>Rate us:</h3>
<Rate rating={rating} setRating={setRating} />
<div className='form-div'>
Expand Down

0 comments on commit 265ede3

Please sign in to comment.