From 6b3a14cf1e61bba1cd799b3d3b11d0f649512ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Thu, 24 Nov 2022 13:04:20 +0800 Subject: [PATCH] feat: add tooltip for status action --- components/common/CommonTooltip.vue | 16 +++++ components/status/StatusActionButton.vue | 37 +++++++++++ components/status/StatusActions.vue | 80 +++++++++++++----------- package.json | 1 + plugins/floating-vue.ts | 7 +++ pnpm-lock.yaml | 27 ++++++++ 6 files changed, 132 insertions(+), 36 deletions(-) create mode 100644 components/common/CommonTooltip.vue create mode 100644 components/status/StatusActionButton.vue create mode 100644 plugins/floating-vue.ts diff --git a/components/common/CommonTooltip.vue b/components/common/CommonTooltip.vue new file mode 100644 index 00000000..f80e659c --- /dev/null +++ b/components/common/CommonTooltip.vue @@ -0,0 +1,16 @@ + + + diff --git a/components/status/StatusActionButton.vue b/components/status/StatusActionButton.vue new file mode 100644 index 00000000..c0d023d7 --- /dev/null +++ b/components/status/StatusActionButton.vue @@ -0,0 +1,37 @@ + + + diff --git a/components/status/StatusActions.vue b/components/status/StatusActions.vue index 773256ea..411c073a 100644 --- a/components/status/StatusActions.vue +++ b/components/status/StatusActions.vue @@ -37,45 +37,53 @@ const toggleBookmark = () => toggleStatusAction( diff --git a/package.json b/package.json index 8ad5c323..1f9111a3 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "blurhash": "^2.0.4", "eslint": "^8.27.0", "esno": "^0.16.3", + "floating-vue": "2.0.0-beta.20", "form-data": "^4.0.0", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", diff --git a/plugins/floating-vue.ts b/plugins/floating-vue.ts new file mode 100644 index 00000000..0b012419 --- /dev/null +++ b/plugins/floating-vue.ts @@ -0,0 +1,7 @@ +import FloatingVue from 'floating-vue' +import { defineNuxtPlugin } from '#app' +import 'floating-vue/dist/style.css' + +export default defineNuxtPlugin((nuxtApp) => { + nuxtApp.vueApp.use(FloatingVue) +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e22b2be6..c094ecf9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,7 @@ specifiers: blurhash: ^2.0.4 eslint: ^8.27.0 esno: ^0.16.3 + floating-vue: 2.0.0-beta.20 form-data: ^4.0.0 fs-extra: ^10.1.0 js-yaml: ^4.1.0 @@ -50,6 +51,7 @@ devDependencies: blurhash: 2.0.4 eslint: 8.27.0 esno: 0.16.3 + floating-vue: 2.0.0-beta.20 form-data: 4.0.0 fs-extra: 10.1.0 js-yaml: 4.1.0 @@ -660,6 +662,16 @@ packages: - supports-color dev: true + /@floating-ui/core/0.3.1: + resolution: {integrity: sha512-ensKY7Ub59u16qsVIFEo2hwTCqZ/r9oZZFh51ivcLGHfUwTn8l1Xzng8RJUe91H/UP8PeqeBronAGx0qmzwk2g==} + dev: true + + /@floating-ui/dom/0.1.10: + resolution: {integrity: sha512-4kAVoogvQm2N0XE0G6APQJuCNuErjOfPW8Ux7DFxh8+AfugWflwVJ5LDlHOwrwut7z/30NUvdtHzQ3zSip4EzQ==} + dependencies: + '@floating-ui/core': 0.3.1 + dev: true + /@humanwhocodes/config-array/0.11.7: resolution: {integrity: sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==} engines: {node: '>=10.10.0'} @@ -3952,6 +3964,15 @@ packages: resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==} dev: true + /floating-vue/2.0.0-beta.20: + resolution: {integrity: sha512-N68otcpp6WwcYC7zP8GeJqNZVdfvS7tEY88lwmuAHeqRgnfWx1Un8enzLxROyVnBDZ3TwUoUdj5IFg+bUT7JeA==} + peerDependencies: + vue: ^3.2.0 + dependencies: + '@floating-ui/dom': 0.1.10 + vue-resize: 2.0.0-alpha.1 + dev: true + /follow-redirects/1.15.2: resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} engines: {node: '>=4.0'} @@ -7587,6 +7608,12 @@ packages: - supports-color dev: true + /vue-resize/2.0.0-alpha.1: + resolution: {integrity: sha512-7+iqOueLU7uc9NrMfrzbG8hwMqchfVfSzpVlCMeJQe4pyibqyoifDNbKTZvwxZKDvGkB+PdFeKvnGZMoEb8esg==} + peerDependencies: + vue: ^3.0.0 + dev: true + /vue-router/4.1.6_vue@3.2.45: resolution: {integrity: sha512-DYWYwsG6xNPmLq/FmZn8Ip+qrhFEzA14EI12MsMgVxvHFDYvlr4NXpVF5hrRH1wVcDP8fGi5F4rxuJSl8/r+EQ==} peerDependencies: