-
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
10 changed files
with
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* Ключевые кадры для анимации вращения */ | ||
@keyframes react-spinners-rotate { | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
/* Ключевые кадры для анимации отскока */ | ||
@keyframes react-spinners-bounce { | ||
0%, 100% { | ||
transform: scale(0); | ||
} | ||
50% { | ||
transform: scale(1.0); | ||
} | ||
} | ||
|
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,37 @@ | ||
import './loading.css'; | ||
import React, {JSX} from 'react'; | ||
|
||
export function Loading() : JSX.Element { | ||
// Жестко заданные параметры | ||
const color : string = '#3069a6'; | ||
const size: number = 80; | ||
const speedMultiplier : number = 1; | ||
|
||
const wrapperStyle : React.CSSProperties = { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
position: 'relative', | ||
width: '100vw', | ||
height: '100vh', | ||
animation: `react-spinners-rotate ${2 / speedMultiplier}s 0s infinite linear`, | ||
}; | ||
|
||
const dotStyle = (i: number) : React.CSSProperties => ({ | ||
position: 'relative', | ||
top: i % 2 ? '0' : 'auto', | ||
bottom: i % 2 ? 'auto' : '0', | ||
height: `${size / 2}px`, | ||
width: `${size / 2}px`, | ||
backgroundColor: color, | ||
borderRadius: '100%', | ||
animation: `react-spinners-bounce ${2 / speedMultiplier}s ${i === 2 ? '1s' : '0s'} infinite linear`, | ||
}); | ||
|
||
return ( | ||
<span style={wrapperStyle}> | ||
<span style={dotStyle(1)} /> | ||
<span style={dotStyle(2)} /> | ||
</span> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import {JSX} from 'react'; | ||
import {Helmet} from 'react-helmet-async'; | ||
import {Offer} from '../../types/offer.ts'; | ||
import {Link} from 'react-router-dom'; | ||
import {AppRoute} from '../../const.ts'; | ||
import {useAppSelector} from '../../hooks'; | ||
|
||
type FavoriteScreenProps = { | ||
offers: Offer[]; | ||
} | ||
|
||
export function FavoriteScreen({offers} : FavoriteScreenProps) : JSX.Element { | ||
export function FavoriteScreen() : JSX.Element { | ||
const offers = useAppSelector((state) => state.offers); | ||
const favorites = offers.filter((offer) => offer.isFavorite); | ||
const cities = Array.from(new Set(favorites.map((offer) => offer.city.name))).sort(); | ||
|
||
|
@@ -32,7 +30,7 @@ export function FavoriteScreen({offers} : FavoriteScreenProps) : JSX.Element { | |
<div className="header__avatar-wrapper user__avatar-wrapper"> | ||
</div> | ||
<span className="header__user-name user__name">[email protected]</span> | ||
<span className="header__favorite-count">3</span> | ||
<span className="header__favorite-count">{favorites.length}</span> | ||
</a> | ||
</li> | ||
<li className="header__nav-item"> | ||
|
@@ -72,7 +70,7 @@ export function FavoriteScreen({offers} : FavoriteScreenProps) : JSX.Element { | |
</div>} | ||
<div className="favorites__image-wrapper place-card__image-wrapper"> | ||
<Link to={AppRoute.Offer.replace(':id', favorite.id)}> | ||
<img className="place-card__image" src={`/img/${favorite.imageSrc}`} width="150" height="110" alt="Place image"/> | ||
<img className="place-card__image" src={favorite.previewImage} width="150" height="110" alt="Place image"/> | ||
</Link> | ||
</div> | ||
<div className="favorites__card-info place-card__info"> | ||
|
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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
import {createAction} from '@reduxjs/toolkit'; | ||
import {City} from '../types/city.ts'; | ||
import {Offer} from '../types/offer.ts'; | ||
import {DetailOffer} from '../types/detail-offer.ts'; | ||
import {Review} from '../types/review.ts'; | ||
|
||
export const changeActiveCity = createAction<City>('offers/changeActiveCity'); | ||
|
||
export const setOffers = createAction<Offer[]>('offers/setOffers'); | ||
|
||
export const setDetailOffer = createAction<DetailOffer | null>('offers/setDetailOffer'); | ||
|
||
export const setNearOffers = createAction<Offer[]>('offers/setNearOffers'); | ||
|
||
export const setReviews = createAction<Review[]>('offers/setReviews'); |
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