Class: Fluxbit::SkeletonComponent
- Includes:
- Config::SkeletonComponent
- Defined in:
- app/components/fluxbit/skeleton_component.rb
Overview
The ‘Fluxbit::SkeletonComponent` is a customizable skeleton loading component that extends `Fluxbit::Component`. It provides animated placeholders for content that is loading, supporting various types like text, images, cards, avatars, and more complex layouts.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**props) ⇒ Fluxbit::SkeletonComponent
constructor
Initializes the skeleton component with the given properties.
Methods inherited from Component
#add, #add_popover_or_tooltip, #anyicon, #element_name, #fx_id, #icon, #options, #popover?, #random_id, #remove_class, #remove_class_from_props, #render_popover_or_tooltip, #target, #tooltip?
Methods included from IconHelpers
#chevron_double_left, #chevron_double_right, #chevron_down, #chevron_left, #chevron_right, #chevron_up, #close_icon, #ellipsis_horizontal, #eye_icon, #eye_slash_icon, #plus_icon
Constructor Details
#initialize(**props) ⇒ Fluxbit::SkeletonComponent
Initializes the skeleton component with the given properties.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/components/fluxbit/skeleton_component.rb', line 30 def initialize(**props) super @props = props @variant = (@props.delete(:variant), collection: [ :default, :text, :image, :video, :avatar, :card, :widget, :list, :testimonial, :button ], default: @@variant) @animation = (@props.delete(:animation), default: @@animation) @rows = (@props.delete(:rows), default: @@rows).to_i @size = (@props.delete(:size), collection: [ :small, :medium, :large ], default: :medium) @lines = @props.delete(:lines)&.to_i declare_classes @props[:class] = remove_class(@props.delete(:remove_class) || "", @props[:class]) @props[:role] = "status" @props["aria-label"] = "Loading" end |
Instance Method Details
#call ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/components/fluxbit/skeleton_component.rb', line 48 def call tag.div(**@props) do case @variant when :default, :text render_text_skeleton when :image render_image_skeleton when :video render_video_skeleton when :avatar render_avatar_skeleton when :card render_card_skeleton when :widget when :list render_list_skeleton when :testimonial render_testimonial_skeleton when :button end end end |