feat: gravatar integration

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent 142db19627
commit 5d69e4a8aa
5 changed files with 94 additions and 20 deletions
+17
View File
@@ -0,0 +1,17 @@
import {Controller} from '@hotwired/stimulus'
export default class extends Controller {
static values = {url: String, alt: String}
static classes = ['image']
connect() {
const img = new Image()
img.onload = () => {
img.classList.add(...this.imageClasses)
this.element.innerHTML = ''
this.element.appendChild(img)
}
img.alt = this.altValue
img.src = this.urlValue
}
}