class Ariadne::UI::Avatar::Component

def before_render

def before_render
  validate!
  # must be done here rather than within an `accepts_html_attributes` block
  # because it's dependewnt on `with_badge_*` slot's existence, which isn't known until now
  html_attrs[:class] = merge_tailwind_classes([style(size:, shape:, has_src: src.present?, has_badge: badge), html_attrs[:class]].join(" "))
  # One char long or two
  len = [:xs, :sm, :md].include?(size) ? 0 : 1
  @placeholder_text = (text || "").strip.split[0..len].map { |word| word.capitalize[0] }.join
  html_attrs[:aria] = merge_aria(
    html_attrs, {
      aria: {
        label: text || alt,
      },
    }
  )
end