From 10143fffec9e498ec9febcf0019f9b598dd6a695 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 14 Nov 2022 10:56:48 +0800 Subject: [PATCH] feat: styling --- components/AccountInfo.vue | 1 + components/status/StatusActions.vue | 32 +++++++++++++--------- components/status/StatusCard.vue | 42 ++++++++++++++++++++++++++++- components/status/StatusMedia.vue | 21 +++++++++++++++ unocss.config.ts | 4 ++- 5 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 components/status/StatusMedia.vue diff --git a/components/AccountInfo.vue b/components/AccountInfo.vue index 50a69d45..a9fa6031 100644 --- a/components/AccountInfo.vue +++ b/components/AccountInfo.vue @@ -21,5 +21,6 @@ defineProps<{ @{{ account.acct }}

+ diff --git a/components/status/StatusActions.vue b/components/status/StatusActions.vue index 6c5590f0..41ec26a1 100644 --- a/components/status/StatusActions.vue +++ b/components/status/StatusActions.vue @@ -7,21 +7,29 @@ defineProps<{ diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 97dfd028..ea9e8646 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -11,12 +11,52 @@ function go(e: MouseEvent) { if (e.target === el.value) router.push(`/@${status.account.acct}/${status.id}`) } + +const timeago = useTimeAgo(() => status.createdAt, { + showSecond: true, + messages: { + justNow: 'just now', + past: n => n, + future: n => n.match(/\d/) ? `in ${n}` : n, + month: (n, past) => n === 1 + ? past + ? 'last month' + : 'next month' + : `${n}m`, + year: (n, past) => n === 1 + ? past + ? 'last year' + : 'next year' + : `${n}y`, + day: (n, past) => n === 1 + ? past + ? 'yesterday' + : 'tomorrow' + : `${n}d`, + week: (n, past) => n === 1 + ? past + ? 'last week' + : 'next week' + : `${n} week${n > 1 ? 's' : ''}`, + hour: n => `${n}h`, + minute: n => `${n}min`, + second: n => `${n}s`, + }, +}) diff --git a/components/status/StatusMedia.vue b/components/status/StatusMedia.vue new file mode 100644 index 00000000..b3772661 --- /dev/null +++ b/components/status/StatusMedia.vue @@ -0,0 +1,21 @@ + + + diff --git a/unocss.config.ts b/unocss.config.ts index 1380dc53..f1e9e9be 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -13,7 +13,9 @@ export default defineConfig({ shortcuts: [ ], presets: [ - presetUno(), + presetUno({ + attributifyPseudo: true, + }), presetAttributify(), presetIcons({ scale: 1.2,