Sha256: 9160070287d3bd3a8f9811a78e51a39a5c1aa4ca35236eed3685caf4a67aef25

Contents?: true

Size: 822 Bytes

Versions: 48

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbAvatar
    class Avatar < Playbook::KitBase
      prop :image_url, type: Playbook::Props::String
      prop :image_alt, type: Playbook::Props::String,
                       default: ""
      prop :name, type: Playbook::Props::String,
                  default: ""
      prop :size, type: Playbook::Props::Enum,
                  values: %w[xxs xs sm md base lg xl],
                  default: "md"
      prop :status

      def initials
        name.split.map(&:first).join.downcase
      end

      def classname
        generate_classname("pb_avatar_kit", size)
      end

      def online_status_props
        { status: status, classname: "size_#{size}" }
      end

      def handle_img_error
        "this.style.display = 'none'"
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
playbook_ui-10.1.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.0.1.alpha.rtflexfix app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.0.1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.0.0 app/pb_kits/playbook/pb_avatar/avatar.rb