Sha256: d527ed4f74e3927718aaaad3576d3f6fe402ed2558ad66efdba97cfa594b627a

Contents?: true

Size: 984 Bytes

Versions: 11

Compression:

Stored size: 984 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbImage
    class Image < Playbook::KitBase
      prop :alt
      prop :on_error, type: Playbook::Props::String,
                      default: nil
      prop :rounded, type: Playbook::Props::Boolean,
                     default: false
      prop :size, type: Playbook::Props::Enum,
                  values: %w[xs sm md lg xl none],
                  default: "none"
      prop :transition, type: Playbook::Props::Enum,
                        values: %w[blur fade scale none],
                        default: "fade"
      prop :url

      def classname
        generate_classname("pb_image_kit#{size_class} #{transition_class} lazyload") + rounded_class
      end

    private

      def rounded_class
        rounded ? " rounded" : ""
      end

      def size_class
        size == "none" ? nil : "_#{size}"
      end

      def transition_class
        transition == "none" ? nil : transition
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.20.0 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.19.0 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.18.2 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.18.1 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-10.18.0 app/pb_kits/playbook/pb_image/image.rb