Refactor toggles to work without JS, add specs

This commit is contained in:
Râu Cao
2023-03-15 14:04:12 +07:00
committed by Gitea
parent ca1221e9f3
commit fa56d6b772
12 changed files with 86 additions and 50 deletions
@@ -1,8 +1,8 @@
<%= button_tag type: "button",
data: @data,
<%= button_tag type: "button", name: "toggle", data: @data,
role: "switch", aria: { checked: @enabled.to_s },
disabled: !@input_enabled,
class: "#{ @enabled ? 'bg-blue-600' : 'bg-gray-200' }
#{ @class_names.present? ? @class_names : '' }
relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer
rounded-full border-2 border-transparent transition-colors
duration-200 ease-in-out focus:outline-none focus:ring-2