From 4dbc9baa07c3375cd79ead2cc9d72994011964f9 Mon Sep 17 00:00:00 2001 From: eth3lbert Date: Mon, 3 Mar 2025 21:24:15 +0800 Subject: [PATCH] versions: Improve the loading indicator This shows a loading indicator for the initial load, and a loading button when loading more. --- app/styles/crate/versions.module.css | 17 +++++++++++++++-- app/templates/crate/versions.hbs | 22 +++++++++++++++------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/styles/crate/versions.module.css b/app/styles/crate/versions.module.css index acde094f03..69a8068508 100644 --- a/app/styles/crate/versions.module.css +++ b/app/styles/crate/versions.module.css @@ -16,6 +16,10 @@ display: block; margin-bottom: var(--space-s); } + + &:global(.is-empty) { + visibility: hidden; + } } .list { list-style: none; @@ -25,9 +29,13 @@ > * + * { margin-top: var(--space-2xs); } + + &:global(.is-empty) { + min-height: calc(2 * var(--space-s) + var(--space-xl)); + } } -.load-more { +.load-more, .loading { --shadow: 0 1px 3px light-dark(hsla(51, 90%, 42%, .35), #232321); /* TODO: move to shared */ @@ -36,13 +44,18 @@ border: 0; padding: 0 var(--space-m); - button { + :not(:global(.is-empty)) + & button { border-radius: var(--space-3xs); box-shadow: var(--shadow); cursor: pointer; position: relative; } + :global(.is-empty) + & button { + background-color: transparent; + position: relative; + } + .loading-spinner { display: inline-flex; align-items: center; diff --git a/app/templates/crate/versions.hbs b/app/templates/crate/versions.hbs index 1582c8fdfc..c1d870e1ff 100644 --- a/app/templates/crate/versions.hbs +++ b/app/templates/crate/versions.hbs @@ -1,7 +1,10 @@
- + {{ this.sortedVersions.length }} of {{ this.crate.num_versions }} {{ this.crate.name }} versions since {{date-format this.crate.created_at 'PPP'}} @@ -16,22 +19,27 @@
-