Sha256: 3ec98bf29e88fdb3cc5380f9e4aa06fa0e2d81715d5ea06223989a73d153c520

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

# typed: false
# frozen_string_literal: true

module Ariadne
  module UI
    module Combobox
      module MenuItem
        class Component < BaseComponent
          option :label
          option :as, default: proc { :link } # :button

          accepts_html_attributes do |html_attrs|
            html_attrs[:class] = style(as:)
            html_attrs["data-input-filter-target"] = "searchString"
            if as == :link && !html_attrs[:target]
              html_attrs[:target] = "_top"
            end
          end

          style do
            base do
              [
                "flex",
                "gap-0.5",
                "items-center",
                "ps-2",
                "pe-1",
                "text-ui-base",
                "rounded",
                "!ring-0",
                "hover:bg-zinc-100",
                "hover:dark:bg-zinc-800",
                "focus-within:bg-zinc-100",
                "focus-within:dark:bg-zinc-800",
              ]
            end
            variants do
              as do
                button do
                  "appearance-none inline-flex w-full"
                end
              end
            end
          end

          def link?
            as == :link
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.70 app/components/ariadne/ui/combobox/menu_item/component.rb
ariadne_view_components-0.0.69 app/components/ariadne/ui/combobox/menu_item/component.rb
ariadne_view_components-0.0.68 app/components/ariadne/ui/combobox/menu_item/component.rb
ariadne_view_components-0.0.67 app/components/ariadne/ui/combobox/menu_item/component.rb
ariadne_view_components-0.0.66 app/components/ariadne/ui/combobox/menu_item/component.rb
ariadne_view_components-0.0.65 app/components/ariadne/ui/combobox/menu_item/component.rb
ariadne_view_components-0.0.64 app/components/ariadne/ui/combobox/menu_item/component.rb