Compare commits

...

3 Commits

Author SHA1 Message Date
4c7f4357d2 add fav btn+ event
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 41s
Build Docker Image Back / run (pull_request) Successful in 22s
JsDocs / coverage (pull_request) Successful in 24s
Test and coverage / coverage (pull_request) Failing after 1m27s
2024-06-04 23:21:37 +02:00
c1037d893e add fav checkbox 2024-06-04 23:07:57 +02:00
2a6ede1bae change template type 2024-06-04 23:07:39 +02:00
3 changed files with 20 additions and 8 deletions

View File

@ -1,7 +1,7 @@
--- ---
import type { Input as Props } from 'types'; import type { Input as Props } from 'types';
const { checked ,name, label, autocomplete, placeholder, divClass, inputClass} = Astro.props; const {value, checked ,name, label, autocomplete, placeholder, divClass, inputClass} = Astro.props;
--- ---
@ -14,6 +14,7 @@ const { checked ,name, label, autocomplete, placeholder, divClass, inputClass} =
name={name} name={name}
id={name} id={name}
checked={checked} checked={checked}
value={value}
autocomplete={autocomplete} autocomplete={autocomplete}
placeholder={placeholder} placeholder={placeholder}
class={"mr-2 size-5 " + inputClass} class={"mr-2 size-5 " + inputClass}

View File

@ -32,7 +32,8 @@ const metadata = {
<p class="text-center text-xl mb-3">Type POI :</p> <p class="text-center text-xl mb-3">Type POI :</p>
<CheckBox <CheckBox
label="Bar, Pub, Café,..." label="Bar, Pub, Café,..."
name="drink" name="filter"
value="drink"
checked checked
/> />
</div> </div>
@ -40,7 +41,8 @@ const metadata = {
<p class="text-center text-xl mb-3">Source :</p> <p class="text-center text-xl mb-3">Source :</p>
<CheckBox <CheckBox
label="Open Trip Maps" label="Open Trip Maps"
name="otm" name="filter"
value="otm"
checked checked
/> />
</div> </div>
@ -128,7 +130,14 @@ const metadata = {
tags += "- " + element + "<br/>" tags += "- " + element + "<br/>"
}) })
const poiMarker = L.marker([element.geometry.coordinates[1],element.geometry.coordinates[0]],icon) const poiMarker = L.marker([element.geometry.coordinates[1],element.geometry.coordinates[0]],icon)
.bindPopup(`<b>${prop.name}</b><br/>note : ${prop.rate} <br/>tags:<br/> ${tags}`) .bindPopup(`<b>${prop.name}</b><br/>note : ${prop.rate} <br/>tags:<br/> ${tags} <p>favori : <p> <input type="checkbox" name="like" id=${element.id}/>`)
.on("click", () => {
document.querySelectorAll<HTMLInputElement>('input[name="like"]').forEach(e => {
e.addEventListener("click", () => {
console.log("poeut");
})
})
})
poiMarker.addTo(map) poiMarker.addTo(map)
poiMarkers.push(poiMarker) poiMarkers.push(poiMarker)
}) })
@ -149,7 +158,7 @@ const metadata = {
} }
} }
// envent pour lancer la recherche // envent pour lancer la recherche
const cooldown = 1000 const cooldown = 400
sender() sender()
let timeoutHandle = window.setTimeout(sender, cooldown) let timeoutHandle = window.setTimeout(sender, cooldown)
@ -168,9 +177,9 @@ const metadata = {
} }
}) })
document.querySelectorAll<HTMLInputElement>("input[type='checkbox']").forEach(e =>{ document.querySelectorAll<HTMLInputElement>("input[name='filter']").forEach(e =>{
e.addEventListener("click", () => { e.addEventListener("click", () => {
switch (e.name) { switch (e.value) {
case "drink": case "drink":
drink = e.checked drink = e.checked
break; break;
@ -195,4 +204,5 @@ const metadata = {
searchBox() searchBox()
}) })
}) })
</script> </script>

View File

@ -162,7 +162,7 @@ export interface Testimonial {
} }
export interface Input { export interface Input {
type: HTMLInputTypeAttribute type?: HTMLInputTypeAttribute
name: string name: string
label?: string label?: string
autocomplete?: string autocomplete?: string
@ -170,6 +170,7 @@ export interface Input {
divClass?: string divClass?: string
inputClass?: string inputClass?: string
checked?: bool checked?: bool
value?:string
} }
export interface Textarea { export interface Textarea {