Skip to content

Commit 0c8e26a

Browse files
committed
add loader to examples
1 parent 6abdc3c commit 0c8e26a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

examples/vite/src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ function AppCore() {
151151
)}
152152

153153
{articles.hasNextPage && (
154-
<button onClick={() => articles.fetchNextPage()} disabled={articles.isFetchingNextPage} className="btn btn-primary mt-4">
154+
<button onClick={() => articles.fetchNextPage()} disabled={articles.isFetching} className="btn btn-primary m-4">
155155
Load next page
156+
{articles.isFetching && <span className="loader" />}
156157
</button>
157158
)}
158159
</>

examples/vite/src/index.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
@tailwind utilities;
44

55
.btn {
6-
@apply px-4 py-2 rounded;
6+
@apply px-4 py-2 rounded inline-flex flex-row gap-1;
7+
8+
&[disabled] {
9+
@apply bg-gray-300 text-gray-500 hover:bg-gray-300 cursor-not-allowed;
10+
}
711
}
812

913
.btn-primary {
@@ -17,3 +21,8 @@
1721
.btn-danger {
1822
@apply bg-red-500 text-white hover:bg-red-700;
1923
}
24+
25+
.loader {
26+
@apply inline-block w-5 h-5 border-[3px] border-transparent border-t-gray-200 rounded-full animate-spin align-middle;
27+
animation-duration: 400ms;
28+
}

0 commit comments

Comments
 (0)