Sha256: d38547212fa93d48092ce822d7ace91e78d563788f3eb46283efb347bc127bfa

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 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

1 entries across 1 versions & 1 rubygems

Version Path
playbook_ui-7.0.0.pre.alpha1 app/pb_kits/playbook/pb_legend/legend.rb