Add toggle switch component, service configs, admin profile links

This commit is contained in:
Râu Cao
2023-03-12 12:55:21 +07:00
committed by Gitea
parent f050d010fd
commit 805733939c
6 changed files with 132 additions and 10 deletions

View File

@@ -0,0 +1,12 @@
<button type="submit" role="switch" aria-checked="false"
class="<%= @enabled ? 'bg-indigo-600' : 'bg-gray-200' %>
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 focus:ring-indigo-600 focus:ring-offset-2">
<!-- <span class="sr&#45;only">Enable</span> -->
<span aria-hidden="true"
class="<%= @enabled ? 'translate-x-5' : 'translate-x-0' %>
pointer-events-none inline-block h-5 w-5 transform rounded-full
bg-white shadow ring-0 transition duration-200 ease-in-out"></span>
</button>

View File

@@ -0,0 +1,9 @@
# frozen_string_literal: true
module FormElements
class ToggleComponent < ViewComponent::Base
def initialize(enabled:)
@enabled = !!enabled
end
end
end