Skip to content

Commit 28eb5e3

Browse files
committed
Update home page spinner
1 parent 2f1148a commit 28eb5e3

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

src/components/shared/spinner.cr

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
class Shared::Spinner < BaseComponent
22
needs text : String
3+
needs width : String?
34

45
def render
56
div class: "f-col align-items:center" do
6-
img(
7+
opts = {
78
class: "htmx-indicator",
8-
src: asset("svgs/spinning-circles.svg"),
9-
alt: text
10-
)
9+
src: asset("svgs/spinning-circles.svg"),
10+
alt: text,
11+
}
12+
13+
if width
14+
opts = opts.merge(style: "width: #{width};")
15+
end
16+
17+
p! opts
18+
19+
img(opts)
1120
end
1221
end
1322
end

src/pages/home/index_page.cr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ class Home::IndexPage < MainLayout
99
hx_get: Home::Htmx::CrystalLatestRelease.path_without_query_params,
1010
hx_swap: "outerHTML",
1111
) do
12-
mount Shared::Spinner, text: "获取最新版本..."
12+
a href: "" do
13+
span class: "f-row align-items:center" do
14+
text "Latest release:"
15+
mount Shared::Spinner, text: "获取最新版本...", width: "10px"
16+
end
17+
end
1318
end
1419

1520
tag(

0 commit comments

Comments
 (0)