Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ updates:
- "@types/react"
- "react"
- "react-dom"
tailwind:
patterns:
- "@tailwindcss/*"
- "tailwindcss"
testing-library:
patterns:
- "@testing-library/*"
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ tests/
.*
webpack.*
jest.config.js
tailwind.config.js
tsconfig.json
6 changes: 3 additions & 3 deletions demo/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { DemoPage } from "./DemoPage";

export const App = () => {
return (
<main className="bg-slate-900 min-h-screen">
<main className="main">
<DemoPage />
<GithubCorner
octoColor="#0f172a"
bannerColor="#e2e8f0"
octoColor="#323232"
bannerColor="#ebebeb"
href="https://github.com/no23reason/react-geolocated"
/>
</main>
Expand Down
84 changes: 40 additions & 44 deletions demo/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,48 @@ export const Demo = () => {
});

return (
<div className="p-4 m-4 bg-slate-100 rounded-sm max-w-md mx-auto bg-white drop-shadow-lg flex flex-col items-center space-x-4">
<div className="text-slate-900">
<div className="m-8 font-bold text-l">
{!isGeolocationAvailable ? (
<div>Your browser does not support Geolocation.</div>
) : !isGeolocationEnabled ? (
<div>Geolocation is not enabled.</div>
) : coords ? (
<div>
You are at{" "}
<span className="coordinate">
{formatDegrees(coords.latitude, false)}
<div className="demo">
<div className="demo-data">
{!isGeolocationAvailable ? (
<div>Your browser does not support Geolocation.</div>
) : !isGeolocationEnabled ? (
<div>Geolocation is not enabled.</div>
) : coords ? (
<div>
You are at{" "}
<span className="coordinate">
{formatDegrees(coords.latitude, false)}
</span>
,{" "}
<span className="coordinate">
{formatDegrees(coords.longitude, true)}
</span>
{coords.altitude ? (
<span>
, approximately {coords.altitude} meters above
sea level
</span>
,{" "}
<span className="coordinate">
{formatDegrees(coords.longitude, true)}
</span>
{coords.altitude ? (
<span>
, approximately {coords.altitude} meters
above sea level
</span>
) : null}
.
</div>
) : (
<div>Getting the location data&hellip;</div>
)}
{!!positionError && (
<div>
<br />
Last position error:
<pre>{JSON.stringify(positionError)}</pre>
</div>
)}
</div>
</div>
<div className="flex items-center space-x-2">
<button
className="bg-sky-600 hover:bg-sky-800 py-2 px-4 rounded-md"
onClick={getPosition}
type="button"
>
Get location
</button>
) : null}
.
</div>
) : (
<div>Getting the location data&hellip;</div>
)}
{!!positionError && (
<div>
<br />
Last position error:
<pre>{JSON.stringify(positionError)}</pre>
</div>
)}
</div>
<button
className="get-position"
onClick={getPosition}
type="button"
>
Get location
</button>
</div>
);
};
39 changes: 12 additions & 27 deletions demo/DemoPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,37 @@ import { Demo } from "./Demo";

export const DemoPage = () => {
return (
<article className="p-8 bg-slate-800 min-h-screen text-slate-200 max-w-3xl mx-auto">
<h1 className="text-3xl font-bold my-4">react-geolocated</h1>
<article className="article">
<h1>react-geolocated</h1>
<p>
React.js hook for using{" "}
<a
className="text-sky-400 hover:underline"
href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation"
>
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation">
Geolocation API
</a>
</p>
<h2 className="text-xl font-bold my-3 mt-4">Elevator pitch</h2>
<h2>Elevator pitch</h2>
<p>
react-geolocated is a{" "}
<a
className="text-sky-400 hover:underline"
href="https://github.com/no23reason/react-geolocated#configuration"
>
<a href="https://github.com/no23reason/react-geolocated#configuration">
configurable
</a>{" "}
React Hook that makes using the Geolocation API
easy, abstracting away some browser-specific quirks (differences
on how they handle permissions for example).
React Hook that makes using the Geolocation API easy,
abstracting away some browser-specific quirks (differences on
how they handle permissions for example).
</p>
<h2 className="text-xl font-bold my-3 mt-4">Demo</h2>
<h2>Demo</h2>
<Demo />
<p>
The{" "}
<a
className="text-sky-400 hover:underline"
href="https://github.com/no23reason/react-geolocated/tree/master/demo"
>
<a href="https://github.com/no23reason/react-geolocated/tree/master/demo">
demo source code
</a>{" "}
is available on{" "}
<a
className="text-sky-400 hover:underline"
href="https://github.com/no23reason/react-geolocated"
>
<a href="https://github.com/no23reason/react-geolocated">
GitHub
</a>
, as well as the{" "}
<a
className="text-sky-400 hover:underline"
href="https://github.com/no23reason/react-geolocated/tree/master/demo"
>
<a href="https://github.com/no23reason/react-geolocated/tree/master/demo">
README
</a>{" "}
with configuration options and other details.
Expand Down
71 changes: 70 additions & 1 deletion demo/index.css
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
@import "tailwindcss";
/* Grayscale Design palette: https://grayscale.design/app?lums=98.10,96.40,90.10,83.30,75.60,65.80,52.60,37.40,15.20,12.80,6.40,3.20&palettes=&filters=&names=&labels= */
:root {
--grayscale-50: rgb(253, 253, 253);
--grayscale-100: rgb(251, 251, 251);
--grayscale-200: rgb(244, 244, 244);
--grayscale-300: rgb(235, 235, 235);
--grayscale-400: rgb(225, 225, 225);
--grayscale-500: rgb(212, 212, 212);
--grayscale-600: rgb(192, 192, 192);
--grayscale-700: rgb(165, 165, 165);
--grayscale-800: rgb(109, 109, 109);
--grayscale-900: rgb(100, 100, 100);
--grayscale-1000: rgb(72, 72, 72);
--grayscale-1100: rgb(50, 50, 50);
}

body {
background-color: var(--grayscale-1100);
color: var(--grayscale-300);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
padding: 0;
margin: 0;
}

.main {

a {
color: var(--grayscale-300);
text-decoration: underline;
}

a:hover {
color: var(--grayscale-600);
text-decoration: none;
}
}

.article {
background-color: var(--grayscale-900);
max-width: 40rem;
margin: 0 auto;
padding: 1rem;
}

.demo {
background-color: var(--grayscale-300);
padding: 1rem;
margin: 1rem 0;
color: var(--grayscale-1100);
border-radius: 0.5rem;
}

.demo-data {
margin: 1rem;
font-weight: bold;
}

.get-position {
background-color: var(--grayscale-1000);
color: var(--grayscale-300);
cursor: pointer;
border: none;
border-radius: 0.5rem;
margin: 1rem;
padding: 0.5rem;
}

.get-position:hover {
background-color: var(--grayscale-800);
}
18 changes: 9 additions & 9 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>react-geolocated</title>
<link href="./index.css" rel="stylesheet" />
<script type="module" src="./index.tsx"></script>
</head>
<body>
<div id="root" />
</body>
<head>
<meta charset="utf-8" />
<title>react-geolocated</title>
<link href="./index.css" rel="stylesheet" />
<script type="module" src="./index.tsx"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
Loading
Loading