Skip to content

Commit

Permalink
add small version of the loader component
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Apr 23, 2023
1 parent 7ad74f1 commit 501d561
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/components/loader_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
class LoaderComponent < ViewComponent::Base
include ActionView::Helpers::TagHelper

def initialize(small: false)
super
@small = small
end
def call
content_tag(:div, class: 'd-flex align-items-center flex-column') do
content_tag(:div, class:'spinner-border') do
content_tag(:div, class:"spinner-border #{small? ? small_class : ''}") do
content_tag(:span) do
'Loading'
end
Expand All @@ -16,4 +20,11 @@ def call
end
end

def small?
@small
end
def small_class
"spinner-border-sm"
end

end

0 comments on commit 501d561

Please sign in to comment.