Sha256: 99c09b6614bad5f16924b388cd4225da50e5ca89ebf5b02de21190210795ecdd

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

# typed: false
# frozen_string_literal: true

module Ariadne
  module UI
    module Card
      class Component < Ariadne::BaseComponent
        option :href, default: -> { nil }

        renders_one :header, Ariadne::UI::Card::Header::Component

        accepts_html_attributes do |html_attrs|
          html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style(link: href.present? ? :yes : :no), html_attrs[:class]].join(" "))
        end

        renders_one :footer, Ariadne::UI::Card::Footer::Component

        style do
          base do
            [
              "ariadne-rounded-lg",
              "ariadne-border",
              "ariadne-bg-foreground",
              "dark:ariadne-bg-foreground-dark",
              "ariadne-text-content",
              "dark:ariadne-text-content-dark",
            ]
          end

          variants do
            link do
              no do
                []
              end

              yes do
                [
                  "hover:ariadne-shadow-md",
                  "hover:ariadne-border-indigo-600",
                  "dark:hover:ariadne-border-indigo-400",
                  "hover:ariadne-bg-foreground-700/10",
                  "dark:hover:ariadne-bg-foreground-300/10",
                ]
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.85 app/components/ariadne/ui/card/component.rb
ariadne_view_components-0.0.84 app/components/ariadne/ui/card/component.rb
ariadne_view_components-0.0.83.3 app/components/ariadne/ui/card/component.rb
ariadne_view_components-0.0.83.2 app/components/ariadne/ui/card/component.rb
ariadne_view_components-0.0.83.1 app/components/ariadne/ui/card/component.rb
ariadne_view_components-0.0.83 app/components/ariadne/ui/card/component.rb