Skip to content

Commit

Permalink
v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bubalekh committed Jun 15, 2023
1 parent b74d104 commit d474321
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 3 deletions.
Empty file added src/0-app/App.jsx
Empty file.
10 changes: 8 additions & 2 deletions src/4-features/user-marker/ui/user-marker.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {useEffect, useState} from 'react';
import {Marker, Popup, useMap, useMapEvents} from "react-leaflet";
import {UserIcon} from "./user-icon.jsx";
import CatPopup from "../../../6-shared/ui/cat-popup.jsx";

const UserMarker = () => {
const [position, setPosition] = useState(null)
const [open, setOpen] = useState(false)
let map = useMap()

useEffect(() => {
Expand All @@ -20,8 +22,12 @@ const UserMarker = () => {
})

return position === null ? null : (
<Marker position={position} icon={UserIcon}>
<Popup>You are here</Popup>
<Marker position={position}
icon={UserIcon}
onClick={() => setOpen(true)}>
<CatPopup>
Ololo
</CatPopup>
</Marker>
)
}
Expand Down
21 changes: 21 additions & 0 deletions src/5-entities/cat/ui/cat-card.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import classes from './cat-card.module.css'

const CatCard = (cat) => {

// TODO: get values from cat model
const catImage = 'https://t4.ftcdn.net/jpg/00/97/58/97/360_F_97589769_t45CqXyzjz0KXwoBZT9PRaWGHRk5hQqQ.jpg'
const catName = 'Boris'

return (
<div className={classes.card}>
<img src={catImage} alt="Boris" className={classes.image}/>
<h1>{catName}</h1>
<p className={classes.title}>Хороший уличный кот</p>
<p>Последний раз кормили: вчера в 21:10</p>
<p><button>Покормить!</button></p>
</div>
);
};

export default CatCard;
37 changes: 37 additions & 0 deletions src/5-entities/cat/ui/cat-card.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.card {
width: auto;
margin: auto;
text-align: center;
}

.image {
width: 100%;
}

.title {
color: grey;
font-size: 18px;
}

button {
border: none;
outline: 0;
display: inline-block;
padding: 8px;
color: white;
background-color: #000;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}

a {
text-decoration: none;
font-size: 22px;
color: black;
}

button:hover, a:hover {
opacity: 0.7;
}
13 changes: 13 additions & 0 deletions src/6-shared/ui/cat-popup.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import classes from './cat-popup.module.css'
import {Popup} from "react-leaflet";
import CatCard from "../../5-entities/cat/ui/cat-card.jsx";

export default function CatPopup({children, onClick}) {

return ( //TODO: Cat card!
<Popup autoPan={true}>
<CatCard />
</Popup>
)
}
25 changes: 25 additions & 0 deletions src/6-shared/ui/cat-popup.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.catPopup {
align-items: center;
justify-content: center;
min-width: 250px;
display: flex;
}

.catPopupImage {
display: block;
margin-left: auto;
margin-right: auto;
align-content: center;
}

.catPopupHead {
font-weight: bold;
font-size: 22px;
text-align: center;
}

.catPopupContent {
padding: 25px;
background: white;
border-radius: 16px;
}
2 changes: 1 addition & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import MapView from "./3-widgets/map-view/ui/map-view.jsx";
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<MapView />
</React.StrictMode>,
</React.StrictMode>
)

0 comments on commit d474321

Please sign in to comment.