-
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.
Merge pull request #8 from antoshkaxxr/module6-task1
- Loading branch information
Showing
13 changed files
with
397 additions
and
91 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,28 @@ | ||
type CitiesListProps = { | ||
cities: string[]; | ||
activeCity: string; | ||
onCityChange: (city: string) => void; | ||
}; | ||
|
||
export function CitiesList({ cities, activeCity, onCityChange }: CitiesListProps): JSX.Element { | ||
return ( | ||
<section className="locations container"> | ||
<ul className="locations__list tabs__list"> | ||
{cities.map((city) => ( | ||
<li className="locations__item" key={city}> | ||
<a | ||
className={`locations__item-link tabs__item ${city === activeCity ? 'tabs__item--active' : ''}`} | ||
href="#" | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
onCityChange(city); | ||
}} | ||
> | ||
<span>{city}</span> | ||
</a> | ||
</li> | ||
))} | ||
</ul> | ||
</section> | ||
); | ||
} |
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,6 @@ | ||
import {TypedUseSelectorHook, useDispatch, useSelector} from 'react-redux'; | ||
import type {State, AppDispatch} from '../types/state'; | ||
|
||
export const useAppDispatch = () => useDispatch<AppDispatch>(); | ||
|
||
export const useAppSelector: TypedUseSelectorHook<State> = useSelector; |
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,18 +1,17 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './components/app/app'; | ||
import {Data} from './const'; | ||
import {Offers} from './mocks/offers.ts'; | ||
import {Provider} from 'react-redux'; | ||
import {store} from './store'; | ||
|
||
const root = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
); | ||
|
||
root.render( | ||
<React.StrictMode> | ||
<App | ||
offersNumber={Data.OffersNumber} | ||
offers = {Offers} | ||
/> | ||
<Provider store={store}> | ||
<App /> | ||
</Provider> | ||
</React.StrictMode> | ||
); |
Oops, something went wrong.