Sha256: 5c09bdeb066c0431aba3874c8da20b6d87fa4904f524c46158533f1c2b7e6fa6

Contents?: true

Size: 1.56 KB

Versions: 35

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbSkeletonLoading
    class SkeletonLoading < Playbook::KitBase
      prop :height, type: Playbook::Props::String,
                    default: "16px"
      prop :width, type: Playbook::Props::String,
                   default: "100%"
      prop :border_radius, type: Playbook::Props::Enum,
                           values: %w[none xs sm md lg xl rounded],
                           default: "sm"
      prop :gap, type: Playbook::Props::Enum,
                 values: %w[none xxs xs sm md lg xl xxl],
                 default: "xxs"
      prop :stack, type: Playbook::Props::Number,
                   default: 1
      prop :color, type: Playbook::Props::Enum,
                   values: %w[default white],
                   default: "default"
      prop :dark, type: Playbook::Props::Boolean,
                  default: false

      def classname
        generate_classname("pb_skeleton_loading")
      end

      def global_inline_props
        {}
      end

      def item_classname(index = nil)
        classes = [
          "pb_skeleton_loading_item",
          "border_radius_#{border_radius}",
          "color_#{color}",
          ("dark" if dark),
          gap_class(index),
        ]
        classes.compact.join(" ")
      end

      def item_inline_styles
        styles = []
        styles << "height: #{height}"
        styles << "width: #{width}"
        styles.join("; ")
      end

      def gap_class(index = nil)
        stack > 1 && index.to_i.positive? && gap != "none" ? "gap_#{gap}" : nil
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5341 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5340 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5339 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.12.0.pre.rc.3 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.12.0.pre.rc.2 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.12.0.pre.rc.1 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.12.0.pre.rc.0 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5315 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5314 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.1 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.0.pre.rc.17 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.0 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.0.pre.rc.16 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.10.0.pre.alpha.play16825301 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.0.pre.rc.15 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.0.pre.rc.14 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.0.pre.rc.13 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.11.0.pre.rc.12 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5274 app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb