Sha256: 405c59a1eaf09fe1b423d74bf3c843d38425624adbe3e731590e862aa1c8c554

Contents?: true

Size: 726 Bytes

Versions: 6

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbLegend
    class Legend
      include Playbook::Props

      partial "pb_legend/legend"

      prop :color, type: Playbook::Props::Enum,
                   values: (1..7).map { |n| "data_#{n}" },
                   default: "data_1"

      prop :dark, type: Playbook::Props::Boolean,
                  default: false

      prop :prefix_text

      prop :text, required: true

      def body_color
        dark ? "lighter" : "light"
      end

      def classname
        generate_classname("pb_legend_kit", color, dark ? "dark" : "light")
      end

      def chart_options
        {
          color: color,
          text: text
        }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_legend/legend.rb
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_legend/legend.rb
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_legend/legend.rb
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_legend/legend.rb
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_legend/legend.rb
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_legend/legend.rb