Reflect picked color automatically with a custom stream action

This commit is contained in:
Jorge Manrubia
2025-04-10 13:06:55 +02:00
parent c6b2e5461b
commit e21bb99167
5 changed files with 14 additions and 2 deletions
@@ -0,0 +1,8 @@
import { Turbo } from "@hotwired/turbo-rails"
Turbo.StreamActions.set_css_variable = function() {
const name = this.getAttribute("name")
const value = this.getAttribute("value")
this.targetElements.forEach(element => element.style.setProperty(name, value))
}
+1
View File
@@ -1 +1,2 @@
import "initializers/current"
import "initializers/custom_stream_actions"