Sha256: 59964031340b71b9b00cb9aba5cc5e92263fe3a710cd8bd2d374454454f6cd54
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true class SolidusAdmin::UI::Forms::Switch::Component < SolidusAdmin::BaseComponent SIZES = { s: ' w-8 h-5 after:w-4 after:h-4 after:top-0.5 after:left-0.5 active:after:w-4 after:checked:left-[1.875rem] ', m: ' w-10 h-6 after:w-5 after:h-5 after:top-0.5 after:left-0.5 active:after:w-5 after:checked:left-[2.375rem] ', }.freeze def initialize(size: :m, **attributes) @size = size @attributes = attributes end def call tag.input( type: 'checkbox', class: " #{SIZES.fetch(@size)} appearance-none outline-0 cursor-pointer bg-gray-200 inline-block rounded-full relative after:content-[''] after:absolute after:bg-white after:duration-300 after:rounded-full after:checked:-translate-x-full hover:bg-gray-300 disabled:opacity-40 disabled:cursor-not-allowed checked:bg-gray-500 checked:hover:bg-gray-700 ", **@attributes, ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_admin-0.0.2 | app/components/solidus_admin/ui/forms/switch/component.rb |
solidus_admin-0.0.1 | app/components/solidus_admin/ui/forms/switch/component.rb |