-
Notifications
You must be signed in to change notification settings - Fork 0
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
5 changed files
with
137 additions
and
86 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
78 changes: 33 additions & 45 deletions
78
frontend/src/components/main-page/Garden/PlotInfo/PlotInfoWindow/PlotInfoWindow.js
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,50 +1,38 @@ | ||
import React, {useState, useEffect} from "react"; | ||
import React, { useState, useEffect } from "react"; | ||
|
||
export default function PlotInfoWindow({item}) { | ||
const [isVisible, setIsVisible] = useState(false); | ||
export default function PlotInfoWindow({ item }) { | ||
const [isVisible, setIsVisible] = useState(false); | ||
|
||
useEffect(() => { | ||
if (item) { | ||
setIsVisible(true); | ||
} else { | ||
setIsVisible(false); | ||
} | ||
}, [item]); | ||
useEffect(() => { | ||
if (item) { | ||
setIsVisible(true); | ||
} else { | ||
setIsVisible(false); | ||
} | ||
}, [item]); | ||
|
||
return ( | ||
<div className={`container-plot-wrapper ${isVisible ? "visible" : ""}`}> | ||
<div className="container-plot-info"> | ||
<div className={"container-wrapper-info"}> | ||
<div className={"container-wrapper-img"}> | ||
<img | ||
className="plot-card-img" | ||
src="https://avatars.mds.yandex.net/i?id=b4560f26cb2f9fab2f7395b28c1fed50_l-5236855-images-thumbs&n=13" | ||
alt="img" | ||
></img> | ||
</div> | ||
<div className={"container-for-text"}> | ||
<h3>Лучшее решение для начинающего предпринимателя!</h3> | ||
<ul> | ||
<li> | ||
Минимальные обязательства | ||
</li> | ||
<li> | ||
Простое обслуживание | ||
</li> | ||
<li> | ||
Идеально для сезонного использования | ||
</li> | ||
<li> | ||
Цена: {item.price} | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div className="container-plot-products"> | ||
<h1>ID: {item.id}</h1> | ||
</div> | ||
return ( | ||
<div className={`container-plot-wrapper ${isVisible ? "visible" : ""}`}> | ||
<div className="container-plot-info"> | ||
<div className={"container-wrapper-info"}> | ||
<div className={"container-wrapper-img"}> | ||
<img className="plot-card-img" src={item.url} alt="img"></img> | ||
</div> | ||
<div className={"container-for-text"}> | ||
<h3>Лучшее решение для начинающего предпринимателя!</h3> | ||
<ul> | ||
<li>Минимальные обязательства</li> | ||
<li>Простое обслуживание</li> | ||
<li>Идеально для сезонного использования</li> | ||
<li>Цена: {item.price}</li> | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
</div> | ||
|
||
<div className="container-plot-products"> | ||
<h1>ID: {item.id}</h1> | ||
</div> | ||
</div> | ||
); | ||
} |
54 changes: 26 additions & 28 deletions
54
frontend/src/components/main-page/Garden/SearchCard/SearchCard.js
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,33 +1,31 @@ | ||
import React from "react"; | ||
import {useBasket} from "../../../basket-context/BasketContext"; | ||
import { useBasket } from "../../../basket-context/BasketContext"; | ||
|
||
export default function SearchCard({item, onClick}) { | ||
const {addToBasket} = useBasket(); | ||
return ( | ||
<div className="search-card-wrapper" onClick={onClick}> | ||
<div className="search-card-wrapper-v2"> | ||
<img | ||
className="search-card-img" | ||
src="https://avatars.mds.yandex.net/i?id=b4560f26cb2f9fab2f7395b28c1fed50_l-5236855-images-thumbs&n=13" | ||
alt="img" | ||
></img> | ||
<div> | ||
<h3 className={"header-into-card"}>{item.name}, {item.id}</h3> | ||
export default function SearchCard({ item, onClick }) { | ||
const { addToBasket } = useBasket(); | ||
return ( | ||
<div className="search-card-wrapper" onClick={onClick}> | ||
<div className="search-card-wrapper-v2"> | ||
<img className="search-card-img" src={item.url} alt="img"></img> | ||
<div> | ||
<h3 className={"header-into-card"}> | ||
{item.name}, {item.id} | ||
</h3> | ||
|
||
<div> | ||
Свободно {item.count_free_beds} грядок | ||
<br/> | ||
Цена: {item.price} Рублей / грядка | ||
</div> | ||
</div> | ||
</div> | ||
<div className="add-to-basket" onClick={() => addToBasket(item)}> | ||
<img | ||
className="add-to-basket-img" | ||
src={process.env.PUBLIC_URL + "/plus.svg"} | ||
alt="img" | ||
></img> | ||
</div> | ||
<div> | ||
Свободно {item.count_free_beds} грядок | ||
<br /> | ||
Цена: {item.price} Рублей / грядка | ||
</div> | ||
</div> | ||
); | ||
</div> | ||
<div className="add-to-basket" onClick={() => addToBasket(item)}> | ||
<img | ||
className="add-to-basket-img" | ||
src={process.env.PUBLIC_URL + "/plus.svg"} | ||
alt="img" | ||
></img> | ||
</div> | ||
</div> | ||
); | ||
} |
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