Sha256: 40e9499afb04bd347b1aef256f18b300d29a3442c18afe23f49301d2b0993d73

Contents?: true

Size: 1.43 KB

Versions: 9

Compression:

Stored size: 1.43 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: {}
      prop :dark, type: Playbook::Props::Boolean,
                 default: false

      def classname
        generate_classname("pb_card_kit",
                           selected_class,
                           shadow_class,
                           highlight_position_class,
                           highlight_color_class,
                           dark_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

      def dark_class
        dark ? "dark" : nil
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.16.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.15.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.14.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.13.1 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.13.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.12.0 app/pb_kits/playbook/pb_card/card.rb
playbook_ui-4.11.0 app/pb_kits/playbook/pb_card/card.rb