Places
- {CardProps[0].NumberOfPlaces} places to stay in Amsterdam
+ {offers.length} places to stay in Amsterdam
-
-
-
-
+
@@ -108,4 +117,4 @@ export const MainPage : FC<{ CardProps: cardProperties[] }> = ({ CardProps }) =>
);
-
+export default MainPage;
diff --git a/src/components/MainPageCard/Card.tsx b/src/components/MainPageCard/Card.tsx
deleted file mode 100644
index e6c2be1..0000000
--- a/src/components/MainPageCard/Card.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import {cardProperties} from '../../index.tsx';
-function Card(MainPageCardProps:cardProperties):JSX.Element{
- return(
-
- {MainPageCardProps.Premium ?
-
- Premium
-
: null}
-
-
-
-
- €{MainPageCardProps.Price}
- / night
-
-
-
-
-
- To bookmarks
-
-
-
-
-
{MainPageCardProps.ApartsmentType}
-
- );
-}
-export default Card;
diff --git a/src/components/Offer/Offer.tsx b/src/components/Offer/Offer.tsx
index f8602a6..6c9511b 100644
--- a/src/components/Offer/Offer.tsx
+++ b/src/components/Offer/Offer.tsx
@@ -1,478 +1,485 @@
-export const Offer = () => (
-
-
-
-
-
-
-
-
+import SendCommentForm from '../SendCommentForm/SendCommentForm';
+export default function Offer () {
+ return (
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- Premium
-
-
-
- Beautiful & luxurious studio at great location
-
-
-
-
-
- To bookmarks
-
-
-
-
-
-
Rating
+
+
-
-
- Apartment
-
-
- 3 Bedrooms
-
-
- Max 4 adults
-
-
-
- €120
- night
-
-
-
What's inside
-
- Wi-Fi
- Washing machine
- Towels
- Heating
- Coffee machine
- Baby seat
- Kitchen
- Dishwasher
- Cabel TV
- Fridge
-
-
-
-
Meet the host
-
-
-
+
+
+ Beautiful & luxurious studio at great location
+
+
+
+
+
+ To bookmarks
+
+
+
+
+
+ Rating
-
Angelina
-
Pro
+
4.8
-
-
- A quiet cozy and picturesque that hides behind a a river by
- the unique lightness of Amsterdam. The building is green and
- from 18th century.
-
-
- An independent House, strategically located between Rembrand
- Square and National Opera, but where the bustle of the city
- comes to rest in this alley flowery and colorful.
-
+
+
+ Apartment
+
+
+ 3 Bedrooms
+
+
+ Max 4 adults
+
+
+
+ €120
+ night
-
-
-
- Reviews · 1
-
-
-
-
-
-
-
-
Max
+
+
What's inside
+
+ Wi-Fi
+ Washing machine
+ Towels
+ Heating
+ Coffee machine
+ Baby seat
+ Kitchen
+ Dishwasher
+ Cabel TV
+ Fridge
+
+
+
+
Meet the host
+
+
+
-
-
-
-
- Rating
+ Angelina
+ Pro
+
+
+
+ A quiet cozy and picturesque that hides behind a a river by
+ the unique lightness of Amsterdam. The building is green and
+ from 18th century.
+
+
+ An independent House, strategically located between Rembrand
+ Square and National Opera, but where the bustle of the city
+ comes to rest in this alley flowery and colorful.
+
+
+
+
-
-
-
-
-
-
-
-
- Other places in the neighbourhood
-
-
-
-
-
-
-
- €80
-
- / night
-
+
+
+
+
+
+
-
-
+
+
+ To submit review please make sure to set{' '}
+ rating and describe
+ your stay with at least{' '}
+ 50 characters .
+
+
-
-
- In bookmarks
-
+ Submit
+
+
+
+
+
+
+
+
+
+
+
+ Other places in the neighbourhood
+
+
+
+
-
-
-
-
Rating
+
+
+
+ €80
+
+ / night
+
+
+
+
+
+
+ In bookmarks
+
+
+
+
+
Room
-
-
Room
-
-
+
-
-
-
-
-
- €132
-
- / night
-
-
-
-
-
-
- To bookmarks
-
+
+
-
-
-
-
Rating
+
+
+
+ €132
+
+ / night
+
+
+
+
+
+
+ To bookmarks
+
+
+
+
+
Apartment
-
-
Apartment
-
-
+
-
-
- Premium
-
-
-
-
-
- €180
-
- / night
-
-
-
-
-
-
- To bookmarks
-
+
+
+ Premium
+
+
-
-
-
-
Rating
+
+
+
+ €180
+
+ / night
+
+
+
+
+
+
+ To bookmarks
+
+
+
+
+
Apartment
-
-
Apartment
-
-
-
-
-
-
-
-);
+
+
+
+
+
+
Reviews
+ {}
+
+
+
+ );
+}
diff --git a/src/components/Offer/OfferCard.tsx b/src/components/Offer/OfferCard.tsx
new file mode 100644
index 0000000..f872325
--- /dev/null
+++ b/src/components/Offer/OfferCard.tsx
@@ -0,0 +1,51 @@
+import { Link } from 'react-router-dom';
+
+type Offer = {
+ id: number;
+ title: string;
+ price: number;
+ rating: number;
+ type: string;
+ isPremium: boolean;
+ previewImage: string;
+ NumberOfPlaces: number;
+};
+
+type OfferCardProps = {
+ offer: Offer;
+};
+
+const OfferCard = ({ offer }: OfferCardProps) => (
+
+ {offer.isPremium && (
+
+ Premium
+
+ )}
+
+
+
+
+
+
+
+
+ €{offer.price}
+ / night
+
+
+
+
+ {offer.title}
+
+
{offer.type}
+
+
+);
+
+export default OfferCard;
diff --git a/src/components/Offer/OfferList.tsx b/src/components/Offer/OfferList.tsx
new file mode 100644
index 0000000..d84aa13
--- /dev/null
+++ b/src/components/Offer/OfferList.tsx
@@ -0,0 +1,38 @@
+import { useState } from 'react';
+import OfferCard from './OfferCard';
+
+type Offer = {
+ id: number;
+ title: string;
+ price: number;
+ rating: number;
+ type: string;
+ isPremium: boolean;
+ previewImage: string;
+ NumberOfPlaces: number;
+};
+
+type OfferListProps = {
+ offers: Offer[];
+};
+
+const OfferList = ({ offers }: OfferListProps) => {
+ const [activeOfferId, setActiveOfferId] = useState(null);
+
+ return (
+
+ {offers.map((offer) => (
+
setActiveOfferId(offer.id)}
+ onMouseLeave={() => setActiveOfferId(null)}
+ >
+
+
+ ))}
+
{activeOfferId &&
Active Offer ID: {activeOfferId}
}
+
+ );
+};
+
+export default OfferList;
diff --git a/src/components/SendCommentForm/SendCommentForm.tsx b/src/components/SendCommentForm/SendCommentForm.tsx
new file mode 100644
index 0000000..5c4af3b
--- /dev/null
+++ b/src/components/SendCommentForm/SendCommentForm.tsx
@@ -0,0 +1,60 @@
+import React, { useState } from 'react';
+
+const SendCommentForm = () => {
+ const [rating, setRating] = useState(0);
+ const [comment, setComment] = useState('');
+
+ const handleSubmit = (e: React.FormEvent) => {
+ e.preventDefault();
+ };
+ const numberofstars = [5, 4, 3, 2, 1];
+ return (
+
+ Your review
+
+ {numberofstars.map((star) => (
+
+ setRating(star)}
+ />
+
+
+
+
+
+
+ ))}
+
+
+ setComment(e.target.value)}
+ />
+
+
+
+ To submit review please make sure to set rating and describe your stay
+ with at least 10 characters .
+
+
+ Submit
+
+
+
+ );
+};
+
+export default SendCommentForm;
diff --git a/src/components/User/index.ts b/src/components/User/index.ts
deleted file mode 100644
index 802fec3..0000000
--- a/src/components/User/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export { useUserContext } from './model/useContext';
-export { UserContext, UserContextProvider } from './model';
-export type { UserData, UserDataContext } from './interfaces';
diff --git a/src/components/User/interfaces.ts b/src/components/User/interfaces.ts
deleted file mode 100644
index 92cbf9a..0000000
--- a/src/components/User/interfaces.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export type UserData = {
- logged: boolean;
- email?: string;
- avatarUrl?: string;
-};
-
-export type UserDataContext = {
- user: UserData;
- logout: () => void;
- login: (email: string, password: string) => boolean;
-};
diff --git a/src/components/User/model/index.tsx b/src/components/User/model/index.tsx
deleted file mode 100644
index 7d3ba66..0000000
--- a/src/components/User/model/index.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { createContext, useMemo, useState,FC } from 'react';
-import { UserData, UserDataContext } from '../interfaces';
-import { WithChildren } from '../../../shared/interfaces';
-
-const defaultUserDataValue = {
- logged: false,
-};
-
-const defaultContextValue: UserDataContext = {
- user: defaultUserDataValue,
- logout: () => {},
- login: () => false,
-};
-
-export const UserContext = createContext(defaultContextValue);
-
-export const UserContextProvider:FC = ({ children }) => {
- const [userData, setUserData] = useState(defaultUserDataValue);
-
- const logout = () => setUserData(defaultUserDataValue);
- const login: UserDataContext['login'] = (email, password) => {
- if (password === '123456') {
- setUserData({
- logged: true,
- email,
- });
- return true;
- }
-
- return false;
- };
-
- const contextValue = useMemo(
- () => ({
- user: userData,
- logout,
- login,
- }),
- [userData],
- );
-
- return (
- {children}
- );
-};
diff --git a/src/components/User/model/useContext.tsx b/src/components/User/model/useContext.tsx
deleted file mode 100644
index 5b5029e..0000000
--- a/src/components/User/model/useContext.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-import { useContext } from 'react';
-import { UserContext } from '.';
-
-export const useUserContext = () => useContext(UserContext);
diff --git a/src/index.tsx b/src/index.tsx
index e17c5bb..36201f0 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,71 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
-import {Main} from './components/Main/main';
-
+import App from './App';
+import { offers } from './mock/offers';
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
-type cardProperties={
- Premium:boolean;
- Price:number;
- Img:string;
- ApartsmentType:string;
- Description:string;
- NumberOfPlaces:number;
-};
-export type {cardProperties};
-
-const mainPageCardInfo:cardProperties[] = [
- {
- Premium:true,
- Price:120,
- Img:'../markup/Img/apartment-01.jpg',
- ApartsmentType:'Apartment',
- Description:'Beautiful & luxurious apartment at great location',
- NumberOfPlaces:132
- },
- {
- Premium:false,
- Price:80,
- Img:'../markup/Img/room.jpg',
- ApartsmentType:'Room',
- Description:'Wood and stone place',
- NumberOfPlaces:0
- },
-
- {
- Premium:false,
- Price:132,
- Img:'../markup/Img/apartment-02.jpg',
- ApartsmentType:'Apartment',
- Description:'Canal View Prinsengracht',
- NumberOfPlaces:0
- },
-
- {
- Premium:true,
- Price:180,
- Img:'../markup/Img/apartment-03.jpg',
- ApartsmentType:'Apartment',
- Description:'Nice, cozy, warm big bed apartment',
- NumberOfPlaces:0
- },
-
- {
- Premium:false,
- Price:80,
- Img:'../markup/Img/room.jpg',
- ApartsmentType:'Room',
- Description:'Wood and stone place',
- NumberOfPlaces:0
- }];
-export default {mainPageCardInfo} ;
-
root.render(
-
-
-
+
);
diff --git a/src/mock/offers.ts b/src/mock/offers.ts
new file mode 100644
index 0000000..ac5ea3e
--- /dev/null
+++ b/src/mock/offers.ts
@@ -0,0 +1,42 @@
+export const offers = [
+ {
+ id: 1,
+ title: 'Luxury Apartment in Downtown',
+ price: 250,
+ rating: 4.9,
+ type: 'Apartment',
+ isPremium: true,
+ previewImage: 'img/apartment-01.jpg',
+ NumberOfPlaces: 1,
+ },
+ {
+ id: 2,
+ title: 'Cozy House in Suburbs',
+ price: 100,
+ rating: 4.7,
+ type: 'House',
+ isPremium: false,
+ previewImage: 'img/apartment-02.jpg',
+ NumberOfPlaces: 1,
+ },
+ {
+ id: 3,
+ title: 'Stylish Studio in City Center',
+ price: 150,
+ rating: 4.8,
+ type: 'Studio',
+ isPremium: false,
+ previewImage: 'img/studio-01.jpg',
+ NumberOfPlaces: 1,
+ },
+ {
+ id: 4,
+ title: 'Modern Loft with River View',
+ price: 200,
+ rating: 5.0,
+ type: 'Loft',
+ isPremium: true,
+ previewImage: 'img/studio-01.jpg',
+ NumberOfPlaces: 1,
+ },
+];
diff --git a/src/shared/interfaces.ts b/src/shared/interfaces.ts
deleted file mode 100644
index 886fa90..0000000
--- a/src/shared/interfaces.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export type WithChildren = {
- children: JSX.Element;
-};