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.23.0.pre.cachetest app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.20.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.19.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.18.2 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.18.1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.18.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.17.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.16.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.15.1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.15.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.14.1.pre.alpha1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.14.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-10.13.1 app/pb_kits/playbook/pb_avatar/avatar.rb