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-10.0.0.pre.alphafonts app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.19.0.pre.alpha.pre.fonts2 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.19.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.18.0.flow.bin.alpha app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.18.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.17.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.17.0.pre.decouple.website2 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.16.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.15.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.14.1 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.13.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.12.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.12.0.pre.text.addon app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.11.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.10.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-9.10.0.pre.date.time.stacked.1 app/pb_kits/playbook/pb_avatar/avatar.rb