-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
12 changed files
with
250 additions
and
185 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { useState } from 'react'; | ||
|
||
function CommentForm(): JSX.Element { | ||
const [formData, setFormData] = useState({ | ||
rating: '1', | ||
review: '', | ||
}); | ||
const handleFieldChange = (evt: React.ChangeEvent<HTMLInputElement|HTMLTextAreaElement>): void => { | ||
const {name, value} = evt.target; | ||
setFormData({ | ||
...formData, | ||
[name]: value | ||
}); | ||
}; | ||
|
||
return ( | ||
<form className="reviews__form form" action="#" method="post"> | ||
<label className="reviews__label form__label" htmlFor="review">Your review</label> | ||
<div className="reviews__rating-form form__rating"> | ||
<input className="form__rating-input visually-hidden" name="rating" value="5" id="5-stars" type="radio" onChange={handleFieldChange}/> | ||
<label htmlFor="5-stars" className="reviews__rating-label form__rating-label" title="perfect"> | ||
<svg className="form__star-image" width="37" height="33"> | ||
<use xlinkHref="#icon-star"></use> | ||
</svg> | ||
</label> | ||
|
||
<input className="form__rating-input visually-hidden" name="rating" value="4" id="4-stars" type="radio" onChange={handleFieldChange}/> | ||
<label htmlFor="4-stars" className="reviews__rating-label form__rating-label" title="good"> | ||
<svg className="form__star-image" width="37" height="33"> | ||
<use xlinkHref="#icon-star"></use> | ||
</svg> | ||
</label> | ||
|
||
<input className="form__rating-input visually-hidden" name="rating" value="3" id="3-stars" type="radio" onChange={handleFieldChange}/> | ||
<label htmlFor="3-stars" className="reviews__rating-label form__rating-label" title="not bad"> | ||
<svg className="form__star-image" width="37" height="33"> | ||
<use xlinkHref="#icon-star"></use> | ||
</svg> | ||
</label> | ||
|
||
<input className="form__rating-input visually-hidden" name="rating" value="2" id="2-stars" type="radio" onChange={handleFieldChange}/> | ||
<label htmlFor="2-stars" className="reviews__rating-label form__rating-label" title="badly"> | ||
<svg className="form__star-image" width="37" height="33"> | ||
<use xlinkHref="#icon-star"></use> | ||
</svg> | ||
</label> | ||
|
||
<input className="form__rating-input visually-hidden" name="rating" value="1" id="1-star" type="radio" onChange={handleFieldChange}/> | ||
<label htmlFor="1-star" className="reviews__rating-label form__rating-label" title="terribly"> | ||
<svg className="form__star-image" width="37" height="33"> | ||
<use xlinkHref="#icon-star"></use> | ||
</svg> | ||
</label> | ||
</div> | ||
<textarea className="reviews__textarea form__textarea" id="review" name="review" value={formData.review} onChange={handleFieldChange} placeholder="Tell how was your stay, what you like and what can be improved"></textarea> | ||
<div className="reviews__button-wrapper"> | ||
<p className="reviews__help"> | ||
To submit review please make sure to set <span className="reviews__star">rating</span> and describe your stay with at least <b className="reviews__text-amount">50 characters</b>. | ||
</p> | ||
<button className="reviews__submit form__submit button" type="submit" disabled >Submit</button> | ||
</div> | ||
</form> | ||
); | ||
} | ||
export default CommentForm; |
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,17 @@ | ||
import { Offer } from '../../types/offer'; | ||
import CityCard from '../city-card/city-card'; | ||
|
||
type OfferListProps = { | ||
offers: Offer[]; | ||
}; | ||
|
||
function OfferList({offers}: OfferListProps): JSX.Element { | ||
return ( | ||
<div className="cities__places-list places__list tabs__content"> | ||
{offers.map((offer) => ( | ||
<CityCard key={offer.id} offer={offer}/> | ||
))} | ||
</div> | ||
); | ||
} | ||
export default OfferList; |
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,49 @@ | ||
import { Offer } from '../types/offer'; | ||
import { reviews } from './reviews'; | ||
|
||
export const offers: Offer[] = [ | ||
{ | ||
id: '1', | ||
image: ['img/apartment-01.jpg'], | ||
isPremium: true, | ||
price: 120, | ||
title: 'Beautiful & luxurious studio at great location', | ||
type: 'Apartment', | ||
isFavorite: false, | ||
rating: 4, | ||
reviews: [reviews[0]] | ||
}, | ||
{ | ||
id: '2', | ||
image: ['img/room.jpg'], | ||
isPremium: false, | ||
price: 80, | ||
title: 'Wood and stone place', | ||
type: 'Room', | ||
isFavorite: true, | ||
rating: 4, | ||
reviews: [reviews[1]] | ||
}, | ||
{ | ||
id: '3', | ||
image: ['img/apartment-02.jpg'], | ||
isPremium: false, | ||
price: 132, | ||
title: 'Canal View Prinsengracht', | ||
type: 'Apartment', | ||
isFavorite: false, | ||
rating: 4, | ||
reviews: [reviews[2]] | ||
}, | ||
{ | ||
id: '4', | ||
image: ['img/apartment-03.jpg'], | ||
isPremium: true, | ||
price: 180, | ||
title: 'Nice, cozy, warm big bed apartment', | ||
type: 'Apartment', | ||
isFavorite: true, | ||
rating: 5, | ||
reviews: [reviews[3]] | ||
}, | ||
]; |
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,36 @@ | ||
import { Review } from '../types/review'; | ||
|
||
export const reviews: Review[] = [ | ||
{ | ||
id: '1', | ||
avatar: 'img/avatar-angelina.jpg', | ||
author: 'Angelina', | ||
rating: 5, | ||
date: 'March 2022', | ||
comment: 'Beautiful apartments with stunning views, perfect for those who appreciate comfort and beauty.' | ||
}, | ||
{ | ||
id: '2', | ||
avatar: 'img/avatar-max.jpg', | ||
author: 'Max', | ||
rating: 3, | ||
date: 'December 2023', | ||
comment: 'The room is cozy but lacks sufficient heating, making it uncomfortable during colder months.' | ||
}, | ||
{ | ||
id: '3', | ||
avatar: 'img/avatar-angelina.jpg', | ||
author: 'Angelina', | ||
rating: 5, | ||
date: 'May 2024', | ||
comment: 'Well equipped apartment in a great location with all possible amenities.' | ||
}, | ||
{ | ||
id: '4', | ||
avatar: 'img/avatar-max.jpg', | ||
author: 'Max', | ||
rating: 5, | ||
date: 'December 2024', | ||
comment: 'Luxurious apartments with breathtaking views, ideal for those seeking both comfort and elegance in a prime location.' | ||
} | ||
]; |
Oops, something went wrong.