-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eaefc9a
commit 6312fab
Showing
9 changed files
with
326 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// import { titleApp } from "../utils/settings.ts"; | ||
|
||
export default function Navigation() { | ||
return ( | ||
<nav class="flex h-[50px] absolute top-0 left-0 right-0 bg-blue-800 text-white items-center justify-between px-4"> | ||
<h1 class="text-lg font-bold">TEST</h1> | ||
</nav> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "." | ||
} | ||
], | ||
"settings": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ | |
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]", | ||
"twind": "https://esm.sh/[email protected]", | ||
"twind/": "https://esm.sh/[email protected]/" | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { useState, useEffect} from "preact/hooks"; | ||
|
||
// import fs from 'fs' | ||
|
||
|
||
// import Map from 'ol/Map'; | ||
import Map from "https://cdn.jsdelivr.net/npm/[email protected]/Map.js" | ||
import View from 'https://cdn.jsdelivr.net/npm/[email protected]/View.js'; | ||
import TileLayer from 'https://cdn.jsdelivr.net/npm/[email protected]/Tile.js'; | ||
import XYZ from 'https://cdn.jsdelivr.net/npm/[email protected]/source/XYZ.js'; | ||
import OSM from 'https://cdn.jsdelivr.net/npm/[email protected]/source/OSM.js'; | ||
|
||
// import "https://cdn.jsdelivr.net/npm/[email protected]/ol.css" | ||
|
||
// import { | ||
// Map, | ||
// View, | ||
// TileLayer, | ||
|
||
// } from "https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"; | ||
|
||
// import View from 'ol/View'; | ||
// import TileLayer from 'ol/layer/Tile'; | ||
// import XYZ from 'ol/source/XYZ'; | ||
|
||
|
||
|
||
interface MapProps { | ||
start?: number; | ||
} | ||
|
||
export default function OLMap(props: MapProps) { | ||
// const [count, setCount] = useState(props.start); | ||
|
||
const mapInit = ()=> { | ||
const mymap = new Map({ | ||
target: 'map', | ||
layers: [ | ||
new TileLayer({source: new OSM(),}), | ||
// new TileLayer({source: new XYZ({ url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'})}), | ||
], | ||
view: new View({ | ||
center: [70, 60], | ||
zoom: 2, | ||
}) | ||
|
||
|
||
}); | ||
|
||
} | ||
|
||
useEffect(() => { | ||
// Trigger your effect | ||
|
||
mapInit() | ||
|
||
return () => { | ||
// Optional: Any cleanup code | ||
}; | ||
}, []); | ||
|
||
|
||
|
||
// class="flex w-full h-full" | ||
return ( | ||
|
||
|
||
<div id="map" style="border: 1; height: 800px; width: 100% ;" /> | ||
|
||
|
||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
import { Head } from "$fresh/runtime.ts"; | ||
import Navigation from "../components/Navigation.tsx"; | ||
import Counter from "../islands/Counter.tsx"; | ||
import OLMap from "../islands/OLMap.tsx"; | ||
|
||
// import "https://cdn.jsdelivr.net/npm/[email protected]/ol.css" | ||
|
||
export default function Home() { | ||
return ( | ||
<> | ||
<Head> | ||
<title>Fresh App</title> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ol.css" /> | ||
<title>Map Fresh App</title> | ||
</Head> | ||
<Navigation/> | ||
|
||
<div class="mt-50 max-w-screen-md"> | ||
<OLMap/> | ||
</div> | ||
<div class="p-4 mx-auto max-w-screen-md"> | ||
<img | ||
|
||
|
||
{/* <img | ||
src="/logo.svg" | ||
class="w-32 h-32" | ||
alt="the fresh logo: a sliced lemon dripping with juice" | ||
/> | ||
<p class="my-6"> | ||
/> */} | ||
{/* <p class="my-6"> | ||
Welcome to `fresh`. Try updating this message in the ./routes/index.tsx | ||
file, and refresh. | ||
</p> | ||
</p> */} | ||
|
||
|
||
<Counter start={3} /> | ||
</div> | ||
</> | ||
|