feat: added buggy room tooltip
- Changed map image to local
This commit is contained in:
parent
59113da83a
commit
50da8dc6f5
3 changed files with 52 additions and 12 deletions
BIN
public/map.png
Normal file
BIN
public/map.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 MiB |
35
src/App.css
35
src/App.css
|
|
@ -1,5 +1,4 @@
|
||||||
#root {
|
#root {
|
||||||
max-width: 1280px;
|
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
@ -7,7 +6,6 @@
|
||||||
|
|
||||||
.map {
|
.map {
|
||||||
position: relative;
|
position: relative;
|
||||||
border: solid red 1px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mapimg {
|
.mapimg {
|
||||||
|
|
@ -25,6 +23,28 @@
|
||||||
background: #FFFFFF33;
|
background: #FFFFFF33;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.room:hover .roomtip {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roomtip {
|
||||||
|
align: center;
|
||||||
|
visibility: hidden;
|
||||||
|
color: white;
|
||||||
|
position: relative;
|
||||||
|
top: -100px;
|
||||||
|
background: #555555;
|
||||||
|
border: solid black 1px;
|
||||||
|
border-radius: 15px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roomname {
|
||||||
|
margin: none;
|
||||||
|
padding: none;
|
||||||
|
font-size: 14pt;
|
||||||
|
}
|
||||||
|
|
||||||
.marker {
|
.marker {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
|
@ -34,6 +54,15 @@
|
||||||
background: #888888;
|
background: #888888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markerimg {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
position: relative:
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
border-radius: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
.marker:hover .markertip {
|
.marker:hover .markertip {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
@ -42,7 +71,7 @@
|
||||||
width: 160px;
|
width: 160px;
|
||||||
height: auto;
|
height: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
bottom: 30px;
|
bottom: 90px;
|
||||||
right: 55px;
|
right: 55px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
|
|
|
||||||
29
src/App.jsx
29
src/App.jsx
|
|
@ -1,7 +1,6 @@
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
|
||||||
|
|
||||||
function Marker({ avatar, name, top, left }) {
|
function Marker({ avatar, name, top, left }) {
|
||||||
const _top = top == null ? "50%" : top + '%'
|
const _top = top == null ? "50%" : top + '%'
|
||||||
const _left = left == null ? "50%" : left + '%'
|
const _left = left == null ? "50%" : left + '%'
|
||||||
|
|
@ -11,7 +10,7 @@ function Marker({ avatar, name, top, left }) {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="marker" style={props}>
|
<div className="marker" style={props}>
|
||||||
<img className="marker" src={avatar} alt="{name} avatar"/>
|
<img className="markerimg" src={avatar} alt="{name} avatar"/>
|
||||||
<div className="markertip">
|
<div className="markertip">
|
||||||
{name}
|
{name}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -19,7 +18,7 @@ function Marker({ avatar, name, top, left }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Room({ x, y, w, h, children }) {
|
function Room({ id, name, description, value, x, y, w, h, children }) {
|
||||||
const props = {
|
const props = {
|
||||||
left: x + '%',
|
left: x + '%',
|
||||||
top: y + '%',
|
top: y + '%',
|
||||||
|
|
@ -27,11 +26,13 @@ function Room({ x, y, w, h, children }) {
|
||||||
height: h + '%',
|
height: h + '%',
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="room" style={props}>
|
||||||
className="room"
|
|
||||||
style={props}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
|
<div className="roomtip">
|
||||||
|
<span className="roomname">[#{id}] {name}</span>
|
||||||
|
<br/>{description}
|
||||||
|
<br/>Unlock price: {value} points
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +59,17 @@ function Map() {
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
<Room key={room.id} x={room.x} y={room.y} w={room.w} h={room.h}>
|
<Room
|
||||||
|
id = {room.id}
|
||||||
|
name={room.name}
|
||||||
|
description={room.description}
|
||||||
|
value={room.value}
|
||||||
|
key={room.id}
|
||||||
|
x={room.x}
|
||||||
|
y={room.y}
|
||||||
|
w={room.w}
|
||||||
|
h={room.h}
|
||||||
|
>
|
||||||
{markers}
|
{markers}
|
||||||
</Room>
|
</Room>
|
||||||
)
|
)
|
||||||
|
|
@ -67,7 +78,7 @@ function Map() {
|
||||||
return (
|
return (
|
||||||
<div className="map">
|
<div className="map">
|
||||||
<div>{roomsList}</div>
|
<div>{roomsList}</div>
|
||||||
<img className="mapimg" src="https://2ndbeam.ru/durenije/chelimbalo/poromap.png" alt="SquadQuest map" />
|
<img className="mapimg" src="map.png" alt="SquadQuest map" />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue