Sha256: cd9b2f683e8fa9d0303be999762d6c3e8547c50f8a0ba3d4a7f4ad6445e7a5b0
Contents?: true
Size: 1.46 KB
Versions: 67
Compression:
Stored size: 1.46 KB
Contents
# frozen_string_literal: true module Playbook module PbButton class Button < Playbook::KitBase prop :disabled, type: Playbook::Props::Boolean, default: false prop :full_width, type: Playbook::Props::Boolean, default: false prop :link prop :loading, type: Playbook::Props::Boolean, default: false prop :new_window, type: Playbook::Props::Boolean, default: false prop :variant, type: Playbook::Props::Enum, values: %w[primary secondary link], default: "primary" prop :text prop :type prop :value def options { id: id, data: data, class: classname, disabled: disabled, aria: aria, type: type, value: value, }.compact end def link_options options.merge( href: link, target: new_window ? "_blank" : "_self" ) end def tag link ? "a" : "button" end private def classname generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class) end def disabled_class disabled ? "disabled" : "enabled" end def full_width_class full_width ? "block" : "inline" end def loading_class loading ? "loading" : nil end end end end
Version data entries
67 entries across 67 versions & 1 rubygems