Sha256: dead6c5789c107228ee437c97e4945b91f2c71a0adc929c7a3d1dfdd4f77668f

Contents?: true

Size: 1.25 KB

Versions: 25

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbCard
    class Card
      include Playbook::Props

      partial "pb_card/card"

      prop :selected, type: Playbook::Props::Boolean, default: false
      prop :padding, type: Playbook::Props::Enum,
                     values: %w[none xs sm md lg xl],
                     default: "md"
      prop :shadow, type: Playbook::Props::Enum,
                    values: %w[none deep deeper deepest],
                    default: "none"
      prop :highlight, type: Playbook::Props::Hash,
                       default: {}

      def classname
        generate_classname("pb_card_kit",
                           selected_class,
                           shadow_class,
                           highlight_position_class,
                           highlight_color_class)
      end

    private

      def selected_class
        selected ? "selected" : "deselected"
      end

      def shadow_class
        shadow != "none" ? "shadow_#{shadow}" : nil
      end

      def highlight_position_class
        highlight[:position].present? ? "highlight_#{highlight[:position]}" : nil
      end

      def highlight_color_class
        highlight[:color].present? ? "highlight_#{highlight[:color]}" : nil
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.10.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.9.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.8.2 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.8.1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.7.1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.7.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.6.1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.6.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.5.2 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.5.1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.5.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.4.1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.4.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.3.1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.3.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.2.0 app/pb_kits/playbook/pb_card/card.rb