Sha256: 83f6082a8011bf7b263780afb49581e0ef4d05fe422ea9f80e3aa984ac17f50e

Contents?: true

Size: 1.97 KB

Versions: 7

Compression:

Stored size: 1.97 KB

Contents

# typed: false
# frozen_string_literal: true

module Ariadne
  module UI
    module Link
      class Component < Ariadne::BaseComponent
        option :href

        option :theme, default: proc { :base }
        option :size, default: proc { :base }

        include Ariadne::Behaviors::Tooltipable

        accepts_html_attributes do |html_attrs|
          html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style(theme:, size:), html_attrs[:class]].join(" "))
        end

        style do
          base do
            [
              "ariadne-text-content",
              "dark:ariadne-text-content-dark",
              "ariadne-inline-flex",
              "ariadne-items-center",
              "ariadne-border-b",
              "ariadne-border-transparent",
            ]
          end

          variants do
            theme do
              base do
                [
                  "[&>svg]:ariadne-text-zinc-400",
                  "[&>svg]:dark:ariadne-text-zinc-600",
                  "hover:ariadne-text-indigo-600",
                  "dark:hover:ariadne-text-indigo-400",
                  "hover:ariadne-border-indigo-600",
                  "dark:hover:ariadne-border-indigo-400",
                  "focus:ariadne-text-indigo-600",
                  "dark:focus:ariadne-text-indigo-400",
                  "focus:!ariadne-border-transparent",
                  "active:ariadne-bg-indigo-700/10",
                  "active:dark:ariadne-bg-indigo-300/10",
                ]
              end
              nude { "" }
              thick { "ariadne-font-semibold" }
            end
            size do
              xs { "ariadne-text-xs ariadne-gap-0.5 [&>svg]:ariadne-size-3" }
              sm { "ariadne-text-sm ariadne-gap-0.5 [&>svg]:ariadne-size-4" }
              md { "ariadne-text-base ariadne-gap-1 [&>svg]:ariadne-size-4" }
              lg { "ariadne-text-lg ariadne-gap-1 [&>svg]:ariadne-size-5" }
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.81 app/components/ariadne/ui/link/component.rb
ariadne_view_components-0.0.80.3 app/components/ariadne/ui/link/component.rb
ariadne_view_components-0.0.79.2 app/components/ariadne/ui/link/component.rb
ariadne_view_components-0.0.79.1 app/components/ariadne/ui/link/component.rb
ariadne_view_components-0.0.79 app/components/ariadne/ui/link/component.rb
ariadne_view_components-0.0.78 app/components/ariadne/ui/link/component.rb
ariadne_view_components-0.0.77 app/components/ariadne/ui/link/component.rb