Map update! 🌎
This commit is contained in:
parent
fe32cf5c9c
commit
519b54f2b4
9 changed files with 349 additions and 20 deletions
32
src/components/Coordinates.js
Normal file
32
src/components/Coordinates.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import React, { useState, useEffect } from "react";
|
||||
function Coordinates({ latitude, longitude }) {
|
||||
const [smallScreen, setSmallScreen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (window.screen.width < 480) setSmallScreen(true);
|
||||
else setSmallScreen(false);
|
||||
}, [window.screen.width]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<table className="my-8 text-3xl sm:text-4xl">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="text-left">Latitude:</td>
|
||||
<td className="text-right">
|
||||
{smallScreen ? latitude.slice(0, 7) : latitude}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="text-left">Longitude:</td>
|
||||
<td className="text-right pl-10">
|
||||
{smallScreen ? longitude.slice(0, 7) : longitude}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Coordinates;
|
||||
Loading…
Add table
Add a link
Reference in a new issue