about summary refs log tree commit diff
path: root/src/view/com/util/LoadingPlaceholder.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-11-29 18:17:27 -0600
committerGitHub <noreply@github.com>2023-11-29 16:17:27 -0800
commita59d235e8b319f6c33e0a0221c99c915128826a6 (patch)
tree5565590c364a0a922436e9a34af9a8a70725c9ed /src/view/com/util/LoadingPlaceholder.tsx
parent3ca4bd805a0efa35a9b1d3c4b0a8cebb6cbdeef9 (diff)
downloadvoidsky-a59d235e8b319f6c33e0a0221c99c915128826a6.tar.zst
Improve feed reordering with optimistic updates (#2032)
* Optimisticaly update order of saved feeds

* Better show disabled state for pin button

* Improve loading/disabled states

* Improve placeholder

* Simplify loading components
Diffstat (limited to 'src/view/com/util/LoadingPlaceholder.tsx')
-rw-r--r--src/view/com/util/LoadingPlaceholder.tsx28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/view/com/util/LoadingPlaceholder.tsx b/src/view/com/util/LoadingPlaceholder.tsx
index 461cbcbe5..74e36ff7b 100644
--- a/src/view/com/util/LoadingPlaceholder.tsx
+++ b/src/view/com/util/LoadingPlaceholder.tsx
@@ -171,14 +171,22 @@ export function ProfileCardFeedLoadingPlaceholder() {
 
 export function FeedLoadingPlaceholder({
   style,
+  showLowerPlaceholder = true,
+  showTopBorder = true,
 }: {
   style?: StyleProp<ViewStyle>
+  showTopBorder?: boolean
+  showLowerPlaceholder?: boolean
 }) {
   const pal = usePalette('default')
   return (
     <View
       style={[
-        {paddingHorizontal: 12, paddingVertical: 18, borderTopWidth: 1},
+        {
+          paddingHorizontal: 12,
+          paddingVertical: 18,
+          borderTopWidth: showTopBorder ? 1 : 0,
+        },
         pal.border,
         style,
       ]}>
@@ -193,14 +201,16 @@ export function FeedLoadingPlaceholder({
           <LoadingPlaceholder width={120} height={8} />
         </View>
       </View>
-      <View style={{paddingHorizontal: 5}}>
-        <LoadingPlaceholder
-          width={260}
-          height={8}
-          style={{marginVertical: 12}}
-        />
-        <LoadingPlaceholder width={120} height={8} />
-      </View>
+      {showLowerPlaceholder && (
+        <View style={{paddingHorizontal: 5}}>
+          <LoadingPlaceholder
+            width={260}
+            height={8}
+            style={{marginVertical: 12}}
+          />
+          <LoadingPlaceholder width={120} height={8} />
+        </View>
+      )}
     </View>
   )
 }