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: 1 addition & 3 deletions cmd/web/client/html/partial--error-message.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<div class="alert alert-danger" role="alert"
_="on load wait 3s then transition opacity to 0 then remove me"
>
<div class="alert alert-danger" role="alert" data-controller="auto-dismiss">
{{ .Message }}
</div>
4 changes: 1 addition & 3 deletions cmd/web/client/html/partial--success-message.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<div class="alert alert-success" role="alert"
_="on load wait 3s then transition opacity to 0 then remove me"
>
<div class="alert alert-success" role="alert" data-controller="auto-dismiss">
{{ .Message }}
</div>
16 changes: 16 additions & 0 deletions cmd/web/client/js/controllers/auto_dismiss_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
connect() {
this.dismissTimer = setTimeout(() => {
this.element.style.transition = "opacity 500ms"
this.element.style.opacity = "0"
this.removeTimer = setTimeout(() => this.element.remove(), 500)
}, 3_000)
}

disconnect() {
clearTimeout(this.dismissTimer)
clearTimeout(this.removeTimer)
}
}
3 changes: 0 additions & 3 deletions cmd/web/client/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import htmx from 'htmx.org';
import 'htmx-ext-head-support';
import hyperscript from 'hyperscript.org';
import { Application } from "@hotwired/stimulus"
import { definitionsFromContext } from "@hotwired/stimulus-webpack-helpers"
import 'lazysizes';
Expand All @@ -11,8 +10,6 @@ import '@justinribeiro/lite-youtube'
htmx.config.includeIndicatorStyles = false

window.htmx = htmx
window._hyperscript = hyperscript
window._hyperscript.browserInit()

// this is kinda lame since that means that htmx will never execute any new js
// however that's the closest we can get to turbo behavior which is smart enough
Expand Down
1 change: 0 additions & 1 deletion cmd/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^14.0.0",
"css-loader": "^7.1.4",
"hyperscript.org": "^0.9.91",
"mini-css-extract-plugin": "^2.10.2",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"sass": "^1.99.0",
Expand Down
5 changes: 0 additions & 5 deletions cmd/web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -845,11 +845,6 @@ htmx.org@^2.0.10, htmx.org@^2.0.2:
resolved "https://registry.yarnpkg.com/htmx.org/-/htmx.org-2.0.10.tgz#62442b0e2952a885ae2e50a7654b8b20d0981134"
integrity sha512-kdeJe7ZVwaS6QMz/ebBIVtZdpwen6L0OQ5GOhPV9MKBb196TCZeZu4yA7ZIQsaLKv7EpXz+So7KSXNuHXhj7Cw==

hyperscript.org@^0.9.91:
version "0.9.91"
resolved "https://registry.yarnpkg.com/hyperscript.org/-/hyperscript.org-0.9.91.tgz#3e3566111adf29f9a12833f8b4570d195d2e97d2"
integrity sha512-T9mi1yiGcMu5okkVxju8S330TUc+J4eAVBlosfSGPyexCD9BjR2RoDKi6l8NnP9YRA5ya1w5IMOvxj82HeNMXQ==

icss-utils@^5.0.0, icss-utils@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
Expand Down