-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Истина где-то на сервере #9
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import Location from './location'; | ||
import { SyntheticEvent } from 'react'; | ||
import { listLocation } from '../types/list-location'; | ||
|
||
type ListLocation = { | ||
listLocations: string[]; | ||
listLocations: listLocation; | ||
handleCurrentCityClick: (evt: SyntheticEvent<HTMLSpanElement>) => void; | ||
currentCity: string; | ||
} | ||
|
||
export default function ListLocation({ listLocations, handleCurrentCityClick, currentCity }: ListLocation) { | ||
const listValuesLocations = Object.values(listLocations); | ||
return ( | ||
<ul className="locations__list tabs__list"> | ||
{listLocations.map((location) => <Location key={location} city={location} isActive={currentCity === location} handleCurrentCityClick={handleCurrentCityClick} />)} | ||
{listValuesLocations.map((location) => <Location key={location} city={location} isActive={currentCity === location} handleCurrentCityClick={handleCurrentCityClick} />)} | ||
</ul> | ||
); | ||
} |
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,31 @@ | ||
.loader { | ||
position: relative; | ||
width: 64px; | ||
height: 64px; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
transform: rotate(45deg); | ||
overflow: hidden; | ||
} | ||
.loader:after{ | ||
content: ''; | ||
position: absolute; | ||
inset: 8px; | ||
margin: auto; | ||
background: #222b32; | ||
} | ||
.loader:before{ | ||
content: ''; | ||
position: absolute; | ||
inset: -15px; | ||
margin: auto; | ||
background: #de3500; | ||
animation: diamondLoader 2s linear infinite; | ||
} | ||
@keyframes diamondLoader { | ||
0% ,10% { | ||
transform: translate(-64px , -64px) rotate(-45deg) | ||
} | ||
90% , 100% { | ||
transform: translate(0px , 0px) rotate(-45deg) | ||
} | ||
} |
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,5 @@ | ||
import './loader-style.css'; | ||
|
||
export default function Loader() { | ||
return <span className="loader" />; | ||
} |
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,15 +1,16 @@ | ||
import PlacesOption from './places-option'; | ||
import { placesOption } from '../const'; | ||
import { ListSort } from '../const'; | ||
|
||
type PlacesOptionsProps = { | ||
isOpen: boolean; | ||
handelSortOfferClick: (sortType: string) => void; | ||
} | ||
|
||
export default function PlacesOptions({ isOpen, handelSortOfferClick }: PlacesOptionsProps) { | ||
const listValuesSort = Object.values(ListSort); | ||
return ( | ||
<ul className={`places__options places__options--custom ${isOpen && 'places__options--opened'}`}> | ||
{placesOption.map((place) => <PlacesOption key={place} place={place} handelSortOfferClick={handelSortOfferClick} />)} | ||
{listValuesSort.map((place) => <PlacesOption key={place} place={place} handelSortOfferClick={handelSortOfferClick} />)} | ||
</ul> | ||
); | ||
} |
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,25 @@ | ||
import { OfferPreviews } from '../types/offer-preview'; | ||
import { ListSort } from '../const'; | ||
import { sortPriceLow, sortPriceHigh, sortRating } from '../utils/utils'; | ||
import { LocationCity } from '../const'; | ||
|
||
export function sortingOffers(action: string, state: OfferPreviews[], offers: OfferPreviews[]): OfferPreviews[] { | ||
let sortOffers: OfferPreviews[] = []; | ||
switch (action) { | ||
case ListSort.SORT_POPULAR: | ||
sortOffers = [...offers].filter((offer) => offer.city.name === LocationCity.PARIS); | ||
break; | ||
case ListSort.SORT_PRICE_HIGH: | ||
sortOffers = state.sort(sortPriceHigh); | ||
break; | ||
case ListSort.SORT_PRICE_LOW: | ||
sortOffers = state.sort(sortPriceLow); | ||
break; | ||
case ListSort.SORT_RATED: | ||
sortOffers = state.sort(sortRating); | ||
break; | ||
} | ||
|
||
return sortOffers; | ||
} | ||
|
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Функции получения данных выноси в селекторы (state) => state.isOfferDataLoadingStatus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
функцию useAppSelector нужно обернуть в другую функцию и вызывать ее? Типа: "selector = (data) => {useAppSelector } "