Popup statt Modal für die Koordinaten kopieren
This commit is contained in:
34
components/CoordinatePopup.js
Normal file
34
components/CoordinatePopup.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// components/CoordinatePopup.js
|
||||
import React from "react";
|
||||
|
||||
const CoordinatePopup = ({ isOpen, coordinates, onClose }) => {
|
||||
if (!isOpen) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="absolute z-50 bg-white p-4 rounded-lg shadow-lg"
|
||||
style={{
|
||||
top: "10%", // Zentriert oben, ca. 10% von oben
|
||||
left: "50%",
|
||||
transform: "translateX(-50%)", // Horizontale Zentrierung
|
||||
}}
|
||||
>
|
||||
<h2 className="text-lg font-bold mb-2">Koordinaten</h2>
|
||||
<p className="mb-4">{coordinates}</p>
|
||||
<button
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(coordinates);
|
||||
alert("Koordinaten kopiert!");
|
||||
}}
|
||||
className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600"
|
||||
>
|
||||
Kopieren
|
||||
</button>
|
||||
<button onClick={onClose} className="mt-2 bg-gray-300 text-black px-4 py-2 rounded hover:bg-gray-400">
|
||||
Schließen
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CoordinatePopup;
|
||||
Reference in New Issue
Block a user