From 1bc386893fd817b3464e0d8e0bc1973955d16fc4 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 21 May 2023 01:42:17 +0300 Subject: [PATCH] add generate logic --- package-lock.json | 1 + package.json | 3 +- src/App.tsx | 1 - src/elements/TourCard/index.tsx | 53 ++++++++++++-------- src/pages/GenerateTour/index.tsx | 84 ++++++++++++++++++++++++++++++++ src/pages/GenerateTour/style.css | 9 ++++ src/router.tsx | 6 +++ 7 files changed, 135 insertions(+), 22 deletions(-) create mode 100644 src/pages/GenerateTour/index.tsx create mode 100644 src/pages/GenerateTour/style.css diff --git a/package-lock.json b/package-lock.json index b3cde51..e67331d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "@yandex/ui": "^3.33.0", "antd": "^5.5.0", "axios": "^1.4.0", + "gl-matrix": "^3.4.3", "mapbox-gl": "^2.14.1", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/package.json b/package.json index 0a146f5..7bc8675 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,10 @@ "version": "0.1.0", "private": true, "dependencies": { - "@react-spring/web": "^9.7.2", "@bem-react/classname": "^1.6.0", "@bem-react/core": "^5.1.0", "@bem-react/di": "^5.0.0", + "@react-spring/web": "^9.7.2", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -17,6 +17,7 @@ "@yandex/ui": "^3.33.0", "antd": "^5.5.0", "axios": "^1.4.0", + "gl-matrix": "^3.4.3", "mapbox-gl": "^2.14.1", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/src/App.tsx b/src/App.tsx index 747637c..45ec261 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,7 +3,6 @@ import { Register } from './pages/Register'; import { MyMap } from './сomponents/map'; import 'mapbox-gl/dist/mapbox-gl.css'; -configureRootTheme({ theme }) function App() { return ( diff --git a/src/elements/TourCard/index.tsx b/src/elements/TourCard/index.tsx index b4e4983..5b4976e 100644 --- a/src/elements/TourCard/index.tsx +++ b/src/elements/TourCard/index.tsx @@ -1,7 +1,8 @@ -import React from "react"; +import React, { useState } from "react"; import { Button } from '../../elements/Button' import { Block } from '../../elements/Block' import './style.css' +import { MyMap } from "../../сomponents/map"; export interface PlaceCardIE{ title:string, @@ -30,28 +31,40 @@ export const PlaceCard: React.FC = (props) =>{ export const TourCard:React.FC = (props) =>{ + const [showMap, setShowMap] = useState(false) + return( - -
-
-
{props.title}
-
-
{props.days} дней,
-
{props.placeCards.length} мест
-
-
- - -
-
- { - props.placeCards.map((value, index) => ) - } -
- +
+ {showMap?
+ + + - + +
:null} + +
+
+
{props.title}
+
+
{props.days} дней,
+
{props.placeCards.length} мест
+
+
+ + +
+
+ { + props.placeCards.map((value, index) => ) + } +
+ + +
+
+ ); diff --git a/src/pages/GenerateTour/index.tsx b/src/pages/GenerateTour/index.tsx new file mode 100644 index 0000000..c608d96 --- /dev/null +++ b/src/pages/GenerateTour/index.tsx @@ -0,0 +1,84 @@ +import React, { useState } from "react"; +import { DatePicker, Select } from 'antd'; +import { RusPassHeader } from "../../elements/Header"; +import { Block } from "../../elements/Block"; +import { Button } from "../../elements/Button"; +import { TourCard, TourCardIE } from "../../elements/TourCard"; + +const { RangePicker } = DatePicker; + +export const GenerateTour = () =>{ + + const [dates, setDates] = useState() + const [theme, setTheme] = useState('jack') + + const [generate, setGenerate] = useState(false) + + + + const TourPropsCard = { + title: 'Я покажу тебе Москву', + days: 8, + imageURL: 'https://images.unsplash.com/photo-1575936123452-b67c3203c357?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aW1hZ2V8ZW58MHx8MHx8fDA%3D&w=1000&q=80', + placeCards: [ + { + title:'Парк Горького', + type: 'Место', + imageURL:'https://images.unsplash.com/photo-1575936123452-b67c3203c357?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aW1hZ2V8ZW58MHx8MHx8fDA%3D&w=1000&q=80', + }, + { + title:'Отель Москва', + type: 'Отель', + imageURL:'https://images.unsplash.com/photo-1575936123452-b67c3203c357?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aW1hZ2V8ZW58MHx8MHx8fDA%3D&w=1000&q=80', + }, + { + title:'Ресторан Сказка', + type: 'Ресторан', + imageURL:'https://images.unsplash.com/photo-1575936123452-b67c3203c357?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aW1hZ2V8ZW58MHx8MHx8fDA%3D&w=1000&q=80', + } + ] + } as TourCardIE + + let tours = [] + + for (let i=0; i<=5; i++){ + tours.push( + + ) + } + + return( +
+ +
+ +
+ setDates(e as any)} + > +