Sha256: 8615bc1994cb3300a11f312efe1cff66b6334f423210272d172ce1f7e6c39179

Contents?: true

Size: 908 Bytes

Versions: 365

Compression:

Stored size: 908 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_#{size}")
      end

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

      def alt_text
        image_alt.present? ? image_alt : name
      end

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

Version data entries

365 entries across 365 versions & 1 rubygems

Version Path
playbook_ui-13.21.0.pre.alpha.PBNTR243globalpositioningpropinset2504 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.PLAY12652489 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.PLAY12582474 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.PBNTR224letuserresetrowexpansion2466 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.PLAY120322465 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.pbntr220improveexpansionspeed2451 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.PBNTR224letuserresetrowexpansion2441 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.PBNTR225advancedtablefeedback2438 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.PBNTR238DatePickerYearBug2436 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.pbntr220improveexpansionspeed2431 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0.pre.alpha.pbntr220improveexpansionspeed2415 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.20.0.pre.alpha.play1247htmloptions2404 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.20.0.pre.alpha.play1247htmloptions2403 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.20.0.pre.alpha.PLAY12572402 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.21.0 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.20.0.pre.alpha.PBNTR225advancedtablefeedback2375 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.19.0.pre.alpha.PBNTR200addadvancedtablekitdarkmodestyles2346 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2345 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2342 app/pb_kits/playbook/pb_avatar/avatar.rb
playbook_ui-13.19.0.pre.alpha.play1186collapsiblenaviconcolorbug2321 app/pb_kits/playbook/pb_avatar/avatar.rb