mirror of
https://github.com/we-promise/sure.git
synced 2026-04-14 01:24:06 +00:00
feat: New tag creation UI (#1014)
* feat: Update tag creation UI * fix: remove unused target * fix: remove connect/disconnect functions * fix: remove unnecessary target
This commit is contained in:
18
app/javascript/controllers/color_badge_controller.js
Normal file
18
app/javascript/controllers/color_badge_controller.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
// Connects to data-controller="color-badge"
|
||||
// Used by the transaction merchant form to show a preview of what the avatar will look like
|
||||
export default class extends Controller {
|
||||
static targets = ["name", "badge"];
|
||||
|
||||
handleNameChange = (e) => {
|
||||
this.nameTarget.textContent = e.currentTarget.value || "?";
|
||||
};
|
||||
|
||||
handleColorChange(e) {
|
||||
const color = e.currentTarget.value;
|
||||
this.badgeTarget.style.backgroundColor = `color-mix(in oklab, ${color} 10%, transparent)`;
|
||||
this.badgeTarget.style.borderColor = `color-mix(in oklab, ${color} 10%, transparent)`;
|
||||
this.badgeTarget.style.color = color;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user