feat: gravatar integration

This commit is contained in:
Björn Fromme
2025-10-25 14:09:19 +02:00
parent d55a201681
commit eee7be0c1e
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
}
}