Skip to content

Commit

Permalink
Fix iamrahulmahato#1507 Add rating feature also changes the ui of fee…
Browse files Browse the repository at this point in the history
…back form
  • Loading branch information
[email protected] committed Oct 22, 2024
1 parent fa56528 commit b388023
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 84 deletions.
128 changes: 44 additions & 84 deletions feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,92 +3,52 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Feedback Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4df;
margin: 0;
padding: 0;
}
.container {
width: 50%;
margin: 50px auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
h1 {
text-align: center;
color: #333;
}
h4 {
text-align: center;
color: grey;
}
label {
font-weight: bold;
display: block;
margin-bottom: 5px;
}
input, textarea, select {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border-radius: 4px;
border: 1px solid #ccc;
}
button {
background-color: #5cb85c;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
font-size: 16px;
}
button:hover {
background-color: #7fde1a;
}
.back-button {
position: absolute;
top: 10px;
left: 10px;
background-color: #f0f0f0;
color: #333;
padding: 5px 10px;
text-decoration: none;
border-radius: 4px;
font-size: 14px;
}
.back-button:hover {
background-color: #e0e0e0;
}
</style>
<title>Feedback Form</title>
<link rel="stylesheet" href="style1.css">
</head>
<body>
<a href="#" class="back-button">Back to Home</a>
<div class="container">
<h1>Feedback Form</h1>
<h4>We value your feedback...</h4>
<form action="/submit-feedback" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" placeholder="Enter your name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" placeholder="Enter your email id" required>

<div class="feedback-form">
<h2>Feedback Form</h2>

<!-- Rating Section -->
<div class="form-group rating">
<label for="rating">How would you rate your experience?</label>
<select id="rating" name="rating" required>
<option value="excellent">Excellent</option>
<option value="good">Good</option>
<option value="average">Average</option>
<option value="poor">Poor</option>
</select>
<label for="feedback">Feedback:</label>
<textarea id="feedback" name="feedback" rows="5" placeholder="Write a feedback..." required></textarea>
<button type="submit">Submit Feedback</button>
</form>
<div class="rating-stars">
<input type="radio" name="rating" id="star5" value="5">
<label for="star5" title="5 stars"></label>
<input type="radio" name="rating" id="star4" value="4">
<label for="star4" title="4 stars"></label>
<input type="radio" name="rating" id="star3" value="3">
<label for="star3" title="3 stars"></label>
<input type="radio" name="rating" id="star2" value="2">
<label for="star2" title="2 stars"></label>
<input type="radio" name="rating" id="star1" value="1">
<label for="star1" title="1 star"></label>
</div>
</div>

<!-- Feedback Text Section -->
<div class="name-email-bg">
<div class="form-group">
<label for="name">Name</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
</div>
</div>
<div class="form-group">
<label for="feedback">Your Feedback:</label>
<textarea id="feedback" rows="4" placeholder="Write your feedback here..."></textarea>
</div>


<!-- Submit Button -->
<button class="submit-btn" id="submitBtn">Submit</button>
</div>

<script src="script.js"></script>
</body>
</html>
</html>
3 changes: 3 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
document.getElementById('submitBtn').addEventListener('click', function() {
alert('Thank you for your feedback!');
});
159 changes: 159 additions & 0 deletions style1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/* Variables for light and dark mode */
:root {
--bg: #f8fafc; /* Light mode background */
--primary: #f43f5e;
--btn-color: #fa2b4d;
--btn-text: #fff;
--head: #334155;
--card: #fff; /* Light mode card background */
--p: #4b5563;
}

[data-theme="dark"] {
--bg: #1e293b; /* Dark mode background */
--btn-color: #fecdd3;
--btn-text: #1e293b;
--head: #fff;
--card: #192333; /* Dark mode card background */
--p: #94A3B8;
}

body {
background-color: var(--bg); /* Matches the theme */
color: var(--p);
font-family: 'Arial', sans-serif;
transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

/* Feedback Form Styling */
.feedback-form {
background-color: var(--card); /* Matches the theme */
padding: 20px;
border-radius: 10px;
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1);
max-width: 500px;
margin: 50px auto;
transition: all 0.3s ease-in-out;
}

.feedback-form h2 {
color: var(--head);
text-align: center;
margin-bottom: 20px;
}

/* Rating Styling */
.rating-stars {
display: flex;
gap: 10px;
}

.rating-stars label {
width: 20px;
height: 20px;
background-color: var(--p); /* Use theme color */
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
cursor: pointer;
transition: transform 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.rating-stars input[type="radio"] {
display: none;
}

.rating-stars input[type="radio"]:checked ~ label {
background-color: var(--primary);
}

.rating-stars label:hover {
transform: scale(1.2);
}

/* Form Group Styling */
.form-group {
margin-bottom: 20px;
}

.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: var(--head);
}

.form-group input,
.form-group textarea {
width: 100%;
padding: 10px;
border: 1px solid var(--p);
border-radius: 5px;
background-color: var(--bg); /* Matches the theme */
color: var(--p);
transition: border-color 0.3s ease-in-out;
}

.form-group input:focus,
.form-group textarea:focus {
border-color: var(--primary);
outline: none;
}

/* Submit Button Styling */
.submit-btn {
width: 100%;
padding: 12px;
background-color: var(--btn-color);
color: var(--btn-text);
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.submit-btn:hover {
background-color: var(--primary);
padding: 14px; /* Responsive button hover effect */
}

/* Responsive Design */
@media (max-width: 600px) {
.feedback-form {
padding: 15px;
}

.submit-btn {
font-size: 14px;
}
}
.form-group input {
/* This inherits styles from the existing input rules */
transition: border-color 0.3s ease-in-out;
}

/* Animation for name and email fields */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.form-group {
animation: fadeIn 0.5s ease forwards; /* Apply animation */
}

.name-email-bg {
background-color: var(--card); /* Background color to match theme */
border-radius: 5px; /* Rounded corners for the background */
padding: 10px; /* Padding around the fields */
margin-bottom: 20px; /* Space below the section */
}
.form-group {
margin-bottom: 20px; /* Space between each field */
width: 100%; /* Ensure it takes full width */
}

0 comments on commit b388023

Please sign in to comment.