Sha256: dac259ac479850bb1f56bd4f2528e4636a940523ef8ff1c316a0f45baa8ba76a

Contents?: true

Size: 818 Bytes

Versions: 69

Compression:

Stored size: 818 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[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

69 entries across 69 versions & 1 rubygems

Version Path
playbook_ui-8.3.0.pre.alpha1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.2.1.pre.alpha1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.2.1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.4.0.alpha.dependencies.2 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.4.0.alpha.dependencies.1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.2.0.pre.alpha4 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.2.0.pre.alpha3 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.2.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-8.1.0.pre.alpha1 app/pb_kits/playbook/pb_avatar/avatar.rb