Skip to content

Commit 9ad2e80

Browse files
author
Nick Edwards
committed
Add loading spinner component taken from vita-min
1 parent e69501a commit 9ad2e80

7 files changed

Lines changed: 87 additions & 0 deletions

File tree

app/assets/images/loading.svg

Lines changed: 51 additions & 0 deletions
Loading

app/assets/stylesheets/cfa_ui_components/cfa_ui_components.tailwind.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@
5757
@import "./components/forms.css";
5858
@import "./components/buttons.css";
5959
@import "./components/icons.css";
60+
@import "./components/loading.css";
6061

6162
@import "./utilities/state.css";
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.loading-container {
2+
width: 100%;
3+
display: flex;
4+
justify-content: center;
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="loading-container">
2+
<%= image_tag "loading.svg", alt: "" %>
3+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class LoadingComponent < BaseComponent
4+
def initialize(html_attrs: nil)
5+
super
6+
end
7+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require "test_helper"
4+
5+
class LoadingComponentTest < ViewComponent::TestCase
6+
def test_renders_loading_container
7+
render_inline(LoadingComponent.new)
8+
assert_selector "div.loading-container"
9+
end
10+
11+
def test_renders_loading_image
12+
render_inline(LoadingComponent.new)
13+
assert_selector "div.loading-container img[alt='']"
14+
end
15+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class LoadingComponentPreview < ViewComponent::Preview
2+
def default
3+
render(LoadingComponent.new)
4+
end
5+
end

0 commit comments

Comments
 (0)