Skip to content

Commit

Permalink
Close button
Browse files Browse the repository at this point in the history
  • Loading branch information
art-solopov committed Oct 30, 2023
1 parent d6f32dd commit 314f20e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions assets/css/_trip-show.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
transform: translateY(100%);
}

.btn-close {
float: right;
margin-right: 0.25rem;
margin-top: 0.25rem;
}

h4 {
font-size: 1rem;
text-align: center;
Expand Down
8 changes: 4 additions & 4 deletions assets/js/components/map/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ export class MapController extends BaseController {

activateMarker(_ev) {
this.buttonRowTarget.classList.remove('active')
// ev.preventDefault()
// this.buttonRowTarget.attributes['hx-get'] = ev.params.buttonsRowUrl
// this.buttonRowTarget.setAttribute('hx-get', ev.params.buttonsRowUrl)
// this.buttonRowTarget.dispatchEvent(new CustomEvent('reload-data'))
}

postActivateMarker() {
this.buttonRowTarget.classList.add('active')
}

dismissButtonRow() {
this.buttonRowTarget.classList.remove('active')
}
}

export class MapPointerController extends BaseController {
Expand Down
4 changes: 2 additions & 2 deletions assets/js/components/map/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ function loadMap(options) {
const glc = new mapboxgl.GeolocateControl();
map.addControl(glc);

map.on('click', (ev) => console.log(ev))

resolve(map)
})
})
Expand All @@ -85,11 +87,9 @@ function addPointsMarkers(map, points) {
el.className = `${styles.marker} ${styles[point.category]}`
el.dataset.mapTarget = 'marker'
el.dataset.action = 'click->map#activateMarker'
// el.dataset.mapButtonsRowUrlParam = point.links.buttonsRow
el.setAttribute('role', 'button')
el.setAttribute('hx-get', point.links.buttonsRow)
el.setAttribute('hx-target', '#buttons_row')
// el.setAttribute('hx-trigget', 'click delay:1s')
const icon = ICONS[point.category]

el.innerHTML = `
Expand Down
1 change: 1 addition & 0 deletions trip_planner/templates/points/button_row.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% from "macros/icon.html" import icon %}
{% from "macros/buttons.html" import hx_dialog_attrs %}

<button class="btn-close float-end" type="button" aria-label="Close" data-action="map#dismissButtonRow"></button>
<h4>{{ point.name }}</h4>

<ul>
Expand Down

0 comments on commit 314f20e

Please sign in to comment.