Class: Avo::UI::AvatarComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/avo/u_i/avatar_component.rb

Constant Summary collapse

SIZES =
%w[large medium small tiny].freeze
SHAPES =
%w[rounded square].freeze
THEMES =
%w[default orange yellow green teal blue purple].freeze
TYPES =
%w[avatar placeholder initials].freeze

Constants included from Concerns::FindAssociationField

Concerns::FindAssociationField::ASSOCIATIONS

Instance Method Summary collapse

Methods inherited from BaseComponent

#component_name, #hotkey_badge

Methods included from ApplicationHelper

#a_button, #a_link, #body_classes, #button_classes, #chart_color, #d, #decode_filter_params, #e, #editor_file_path, #editor_url, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_license_warning, #root_path_without_url, #rtl?, #text_direction, #ui, #wrap_in_modal

Methods included from ResourcesHelper

#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #record_path, #record_title, #resource_for_record, #resource_grid, #resource_show_path, #resource_table

Methods included from Concerns::FindAssociationField

#find_association_field

Constructor Details

#initialize(type: "placeholder", size: "large", shape: "rounded", theme: "default", initials: nil, src: nil, alt: nil, **options) ⇒ AvatarComponent

Returns a new instance of AvatarComponent.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/components/avo/u_i/avatar_component.rb', line 7

def initialize(
  type: "placeholder",
  size: "large",
  shape: "rounded",
  theme: "default",
  initials: nil,
  src: nil,
  alt: nil,
  **options
)
  @type = type.to_s
  @size = size.to_s
  @shape = shape.to_s
  @theme = theme.to_s
  @initials = initials
  @src = src
  @alt = alt
  @options = options

  validate_params!
end