Sha256: e83b36cece927c382f84a4e51069740079362c7e58eb0542623ddbea8d81535b

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbTable
    class Table
      include Playbook::Props

      partial "pb_table/table"

      prop :size, type: Playbook::Props::Enum,
                  values: %w[sm md lg],
                  default: "md"
      prop :single_line, type: Playbook::Props::Boolean,
                         default: false
      prop :dark, type: Playbook::Props::Boolean,
                  default: false
      prop :disable_hover, type: Playbook::Props::Boolean,
                           default: false
      prop :container, type: Playbook::Props::Boolean,
                       default: true
      prop :text

      def classname
        generate_classname(
          "pb_table", "table-#{size}", single_line_class, dark_class,
          disable_hover_class, container_class, separator: " "
        )
      end

    private

      def dark_class
        dark ? "dark" : nil
      end

      def single_line_class
        single_line ? "single-line" : nil
      end

      def disable_hover_class
        disable_hover ? "no-hover" : nil
      end

      def container_class
        container ? "table-card" : nil
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
playbook_ui-3.1.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-3.0.1 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-3.0.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-2.9.9 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-2.9.8 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-2.9.7 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-2.9.6 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-2.9.5 app/pb_kits/playbook/pb_table/table.rb