Files
nairobi/app/components/shared/avatar_component.rb
Javi Martín 517f74a748 Extract component to render an initialjs avatar
This way it'll be easier to change it.
2023-10-10 15:03:35 +02:00

24 lines
410 B
Ruby

class Shared::AvatarComponent < ApplicationComponent
attr_reader :record, :given_options
delegate :avatar_image, to: :helpers
def initialize(record, **given_options)
@record = record
@given_options = given_options
end
private
def default_options
{ seed: seed }
end
def options
default_options.merge(given_options)
end
def seed
record.id
end
end