Sha256: 3bdb07a807d2c060c1e9407a654518dc774bf1cad85ef899060ca2f37aa4b0e3

Contents?: true

Size: 1.13 KB

Versions: 36

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbTitle
    class Title < Playbook::KitBase
      prop :color, type: Playbook::Props::Enum,
                   values: [nil, "default", "light", "lighter", "success", "error", "link"],
                   default: nil
      prop :size, type: Playbook::Props::Enum,
                  values: [1, 2, 3, 4],
                  default: 3
      prop :tag, type: Playbook::Props::Enum,
                 values: %w[h1 h2 h3 h4 h5 h6 p div span],
                 default: "h3"
      prop :text
      prop :variant, type: Playbook::Props::Enum,
                     values: [nil, "link"],
                     default: nil,
                     deprecated: true

      def initialize(props)
        props[:bold] = [1, 2, 4].include?(props[:size]) unless props.key?(:bold)
        props[:bold] = false if props[:size].nil? && !props.key?(:bold)
        super(props)
      end

      prop :bold, type: Playbook::Props::Boolean

      def classname
        generate_classname("pb_title_kit", size, variant, color) + is_bold
      end

      def is_bold
        bold ? "" : " thin"
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements842 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements837 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.1.pre.alpha.PLAY860PhoneNumInputOptions836 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements835 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.1.pre.alpha.play716popoverkitcloseonclickissue833 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.1.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown831 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.1 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.multiselectfixes825 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown822 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.multiselectfixes821 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown818 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown817 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown815 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown813 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.alphafix812 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.alphafix810 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.railsmultilevelimprovements805 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.multiselectfixes798 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.multiselectfixes797 app/pb_kits/playbook/pb_title/title.rb
playbook_ui-12.26.0.pre.alpha.multiselectfixes796 app/pb_kits/playbook/pb_title/title.rb