Skip to content

Commit

Permalink
Feat: loading indicator for tiddlers being lazy loaded (#8505)
Browse files Browse the repository at this point in the history
* feat: basic loading

* feat: if condition

* feat: use palette

* refactor: remove css variable
  • Loading branch information
linonetwo committed Sep 24, 2024
1 parent 9a042c0 commit a60e716
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions core/ui/ViewTemplate/lazy-loading.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: $:/core/ui/ViewTemplate/lazy-loading
tags: $:/tags/ViewTemplate

\whitespace trim
<%if [<currentTiddler>has:field[_is_skinny]] %>
<!-- Render the text to trigger lazy-loading -->
{{||$:/core/ui/ViewTemplate/body/default}}
<!-- Indicator of loading state -->
<div class="tc-tiddler-lazy-loading" />
<%endif%>
2 changes: 1 addition & 1 deletion core/wiki/tags/ViewTemplate.tid
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title: $:/tags/ViewTemplate
list: [[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/unfold]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/ViewTemplate/body]]
list: [[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/unfold]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/ViewTemplate/body]] [[$:/core/ui/ViewTemplate/lazy-loading]]
14 changes: 14 additions & 0 deletions themes/tiddlywiki/vanilla/base.tid
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,20 @@ button.tc-btn-invisible.tc-remove-tag-button {
color: <<colour muted-foreground>>;
}

.tc-tiddler-lazy-loading {
height: 4px;
width: 100%;
background: no-repeat linear-gradient(<<colour background>> 0 0),no-repeat linear-gradient(<<colour background>> 0 0),<<colour primary>>;
background-size: 60% 100%;
animation: animation-loading-progress 3s infinite;
}

@keyframes animation-loading-progress {
0% {background-position:-150% 0,-150% 0}
66% {background-position: 250% 0,-150% 0}
100% {background-position: 250% 0, 250% 0}
}

.tc-titlebar h2 {
font-size: 1em;
display: inline;
Expand Down

0 comments on commit a60e716

Please sign in to comment.