Sha256: fe6dff43bb2d8e0b420d3cb7afcc5b5aa6224d247e8ebc7cd066311ad3495822

Contents?: true

Size: 813 Bytes

Versions: 8

Compression:

Stored size: 813 Bytes

Contents

module Spina
  module UserInterface
    class DropdownComponent < ApplicationComponent
      renders_one :button, "ButtonComponent"

      renders_one :menu, "MenuComponent"

      class ButtonComponent < ApplicationComponent
        attr_reader :classes

        def initialize(classes:)
          @classes = classes
        end

        def call
          content_tag :button, content, {type: "button", class: classes, data: {action: "reveal#toggle"}}
        end
      end

      class MenuComponent < ApplicationComponent
        def call
          content_tag :div, content, {class: "origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg border border-gray-200 z-20 rounded-md bg-white shadow-xs py-1", hidden: true, data: {reveal: true, transition: true}}
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spina-2.18.0 app/components/spina/user_interface/dropdown_component.rb
spina-2.17.0 app/components/spina/user_interface/dropdown_component.rb
spina-2.16.0 app/components/spina/user_interface/dropdown_component.rb
spina-2.15.1 app/components/spina/user_interface/dropdown_component.rb
spina-2.15.0 app/components/spina/user_interface/dropdown_component.rb
spina-2.14.0 app/components/spina/user_interface/dropdown_component.rb
spina-2.13.1 app/components/spina/user_interface/dropdown_component.rb
spina-2.13.0 app/components/spina/user_interface/dropdown_component.rb