-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avances reviews, falta conectar con backend
- Loading branch information
Showing
6 changed files
with
71 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { useState } from 'react'; | ||
import StarRating from './StarRating'; // Asegúrate de importar el componente StarRating | ||
|
||
const ReviewForm = () => { | ||
const [rating, setRating] = useState(0); | ||
const [comment, setComment] = useState(''); | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
// Aquí puedes manejar el envío del formulario, por ejemplo, enviando los datos a una API | ||
console.log('Rating:', rating); | ||
console.log('Comment:', comment); | ||
}; | ||
|
||
return ( | ||
<form onSubmit={handleSubmit} className="review-form"> | ||
<p className='event-subtitle'>Puntuar</p> | ||
<hr /> | ||
<StarRating rating={rating} setRating={setRating} /> | ||
<button type="submit">Enviar</button> | ||
|
||
</form> | ||
|
||
); | ||
}; | ||
|
||
export default ReviewForm; |
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,23 @@ | ||
import React, { useState } from 'react'; | ||
import '../styles/ReviewForm.css'; | ||
const StarRating = ({ rating, setRating }) => { | ||
const handleStarClick = (index) => { | ||
setRating(index + 1); | ||
}; | ||
|
||
return ( | ||
<div className="star-rating"> | ||
{[...Array(5)].map((star, index) => ( | ||
<span | ||
key={index} | ||
className={index < rating ? 'star filled' : 'star'} | ||
onClick={() => handleStarClick(index)} | ||
> | ||
{index < rating ? '★' : '☆'} | ||
</span> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default StarRating; |
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,14 @@ | ||
.star-rating { | ||
display: flex; | ||
gap: 5px; | ||
} | ||
|
||
.star { | ||
cursor: pointer; | ||
font-size: 2rem; | ||
color: #ccc; | ||
} | ||
|
||
.star.filled { | ||
color: #f39c12; | ||
} |