Sha256: 63412167cc9e29860ab4935d62e389972d45842fad26a07da8867aa4bde29a7d

Contents?: true

Size: 1014 Bytes

Versions: 2

Compression:

Stored size: 1014 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbBackground
    class Background
      include Playbook::Props

      partial "pb_background/background"

      prop :background_color, type: Playbook::Props::Enum,
                              values: %w[gradient dark light white],
                              default: "light"
      prop :image_url
      prop :padding, type: Playbook::Props::Enum,
                     values: %w[none xs sm md lg xl],
                     default: "md"
      prop :tag, type: Playbook::Props::Enum,
                 values: %w[h1 h2 h3 h4 h5 h6 p div span],
                 default: "div"

      def classname
        generate_classname("pb_background_kit", image_classname, background_color_classname, padding, separator: " ")
      end

    private

      def image_classname
        image_url.present? ? "lazyload blur_up" : ""
      end

      def background_color_classname
        !image_url.present? ? "bg_#{background_color}" : ""
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-7.1.1.pre.alpha1 app/pb_kits/playbook/pb_background/background.rb
playbook_ui-7.0.1.pre.alpha14 app/pb_kits/playbook/pb_background/background.rb