-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b366e9
commit 147d7d3
Showing
7 changed files
with
175 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
.rate-us-container { | ||
border: 1px solid #ccc; | ||
padding: 20px; | ||
width: 350px; | ||
margin: 130px auto 0; | ||
border-radius: 10px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
background-color: rgb(245, 245, 249); | ||
transition: box-shadow 0.3s ease, background-color 0.3s ease; | ||
} | ||
|
||
.rate-us-container:hover { | ||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); | ||
background-color: #f9f9f9; | ||
} | ||
|
||
.rate-us-container h1 { | ||
margin-bottom: 20px; | ||
color: black; | ||
text-align: center; | ||
} | ||
|
||
.stars { | ||
display: flex; | ||
justify-content: center; | ||
margin-bottom: 20px; | ||
} | ||
|
||
label { | ||
display: block; | ||
cursor: pointer; | ||
} | ||
|
||
input[type='radio'] { | ||
display: none; | ||
} | ||
|
||
.star { | ||
color: #e4e5e9; | ||
font-size: 24px; | ||
cursor: pointer; | ||
transition: color 0.2s; | ||
} | ||
|
||
.star:hover, | ||
.star:hover ~ .star { | ||
color: #ffc107; | ||
} | ||
|
||
form { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
textarea { | ||
width: 100%; | ||
height: 120px; | ||
margin-bottom: 10px; | ||
padding: 10px; | ||
border-radius: 5px; | ||
border: 1px solid #ccc; | ||
resize: none; | ||
z-index: 1; | ||
} | ||
|
||
button { | ||
background-color: #4caf50; | ||
color: white; | ||
border: none; | ||
padding: 10px 20px; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
button:hover { | ||
background-color: #45a049; | ||
} | ||
|
||
.toast { | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
background-color: #4caf50; | ||
color: white; | ||
padding: 15px 30px; | ||
border-radius: 8px; | ||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); | ||
z-index: 1000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React, { useState } from 'react'; | ||
import './Rateus.css'; | ||
|
||
const RateUs = () => { | ||
const [rating, setRating] = useState(null); | ||
const [hover, setHover] = useState(null); | ||
const [feedback, setFeedback] = useState(''); | ||
const [showMessage, setShowMessage] = useState(false); // State for showing message | ||
const [message, setMessage] = useState(''); // State for the message content | ||
|
||
const handleSubmit = (event) => { | ||
event.preventDefault(); // Prevent default form submission | ||
|
||
// Show the message for 3 seconds | ||
setMessage(`Thanks For Your Feedback: "${feedback}"`); | ||
setShowMessage(true); | ||
setTimeout(() => { | ||
setShowMessage(false); | ||
setFeedback(''); | ||
}, 3000); | ||
}; | ||
|
||
return ( | ||
<div className="rate-us-container"> | ||
<center><h1>Rate Us</h1></center> | ||
<div className="stars"> | ||
{[...Array(5)].map((_, index) => { | ||
const ratingValue = index + 1; | ||
|
||
return ( | ||
<label key={index}> | ||
<input | ||
type="radio" | ||
name="rating" | ||
value={ratingValue} | ||
onClick={() => setRating(ratingValue)} | ||
/> | ||
<span | ||
className="star" | ||
role="img" | ||
aria-label={`${ratingValue} star`} | ||
style={{ | ||
color: ratingValue <= (hover || rating) ? '#ffc107' : '#e4e5e9', | ||
fontSize: '24px', | ||
cursor: 'pointer' | ||
}} | ||
onMouseEnter={() => setHover(ratingValue)} | ||
onMouseLeave={() => setHover(null)} | ||
> | ||
★ | ||
</span> | ||
</label> | ||
); | ||
})} | ||
</div> | ||
<form onSubmit={handleSubmit}> | ||
<textarea | ||
placeholder="Leave your feedback here..." | ||
value={feedback} | ||
onChange={(e) => setFeedback(e.target.value)} | ||
/> | ||
<button type="submit">Submit</button> | ||
</form> | ||
|
||
{showMessage && ( | ||
<div className="toast"> | ||
{message} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default RateUs; |