From 2ad31fc9c7094fb71b7e87377b20e2f8ee142b23 Mon Sep 17 00:00:00 2001 From: BackRunner Date: Thu, 1 Sep 2022 02:47:30 +0800 Subject: [PATCH] feat: add sync status component --- src/components/common/SyncStatus.vue | 57 +++++++++++++++++++++ src/components/icons/cloudDone.vue | 17 +++++++ src/components/icons/sync.vue | 17 +++++++ src/components/icons/syncError.vue | 17 +++++++ src/styles/common/sync.less | 76 ++++++++++++++++++++++++++++ src/styles/main.less | 1 + src/views/Collection.vue | 40 ++++++++++++++- 7 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 src/components/common/SyncStatus.vue create mode 100644 src/components/icons/cloudDone.vue create mode 100644 src/components/icons/sync.vue create mode 100644 src/components/icons/syncError.vue create mode 100644 src/styles/common/sync.less diff --git a/src/components/common/SyncStatus.vue b/src/components/common/SyncStatus.vue new file mode 100644 index 00000000..83c54b60 --- /dev/null +++ b/src/components/common/SyncStatus.vue @@ -0,0 +1,57 @@ + + + diff --git a/src/components/icons/cloudDone.vue b/src/components/icons/cloudDone.vue new file mode 100644 index 00000000..4b94e37b --- /dev/null +++ b/src/components/icons/cloudDone.vue @@ -0,0 +1,17 @@ + diff --git a/src/components/icons/sync.vue b/src/components/icons/sync.vue new file mode 100644 index 00000000..8c7ead27 --- /dev/null +++ b/src/components/icons/sync.vue @@ -0,0 +1,17 @@ + diff --git a/src/components/icons/syncError.vue b/src/components/icons/syncError.vue new file mode 100644 index 00000000..ad6d12eb --- /dev/null +++ b/src/components/icons/syncError.vue @@ -0,0 +1,17 @@ + diff --git a/src/styles/common/sync.less b/src/styles/common/sync.less new file mode 100644 index 00000000..aa134746 --- /dev/null +++ b/src/styles/common/sync.less @@ -0,0 +1,76 @@ +@keyframes sync-rotate { + 0% { + transform: rotate(360deg); + } + 100% { + transform: rotate(0deg); + } +} + +@keyframes sync-blink { + 0% { + opacity: 1; + } + 50% { + opacity: 0.42; + } + 100% { + opacity: 1; + } +} + +@keyframes sync-completed { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} + +.sync-status { + display: flex; + align-items: center; + height: 28px; + line-height: 28px; + transform: translateY(2px); + margin-left: 12px; + .sync-status__icon { + width: 20px; + height: 28px; + display: flex; + align-items: center; + justify-content: center; + path { + fill: @color-primary; + } + } + .sync-status__icon-sync { + animation: sync-rotate linear 0.85s infinite; + } + .sync-status__text { + color: @color-primary; + font-size: 14px; + letter-spacing: 0.025rem; + margin-left: 6px; + } +} + +.sync-status--syncing { + animation: sync-blink ease-in-out 1s infinite; +} + +.sync-status--completed { + .sync-status__text { + animation-name: sync-completed; + animation-timing-function: ease; + animation-duration: 0.4s; + animation-fill-mode: forwards; + animation-delay: 2.5s; + animation-iteration-count: 1; + } +} + +.sync-status--error { + cursor: pointer; +} diff --git a/src/styles/main.less b/src/styles/main.less index 3af9f53b..d3292147 100644 --- a/src/styles/main.less +++ b/src/styles/main.less @@ -20,6 +20,7 @@ @import './common/maintain.less'; @import './common/login.less'; @import './common/userinfo.less'; +@import './common/sync.less'; /* Views */ diff --git a/src/views/Collection.vue b/src/views/Collection.vue index 1b1ba9b6..eb57c28f 100644 --- a/src/views/Collection.vue +++ b/src/views/Collection.vue @@ -5,6 +5,7 @@
收藏夹 已用栏位 {{ existedCount }}/{{ COLLECTION_SIZE_LIMIT }} +
@@ -42,7 +43,7 @@ />

没有更多收藏了,快去寻找一些你喜欢的画作吧~

@@ -53,8 +54,10 @@