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