refactor: drop Setup suffix for setup components

This commit is contained in:
Daniel Roe 2022-11-25 16:08:30 +00:00
parent fded94c93d
commit f165eebed3
No known key found for this signature in database
GPG key ID: 22D5008E4F5D9B55
9 changed files with 26 additions and 9 deletions

View file

@ -57,7 +57,7 @@ function getFieldNameIcon(fieldName: string) {
<AccountAvatar :account="account" w-30 h-30 />
</NuxtLink>
<div flex flex-col>
<ContentRichSetup font-bold text-2xl break-words :content="getDisplayName(account)" :emojis="account.emojis" />
<ContentRich font-bold text-2xl break-words :content="getDisplayName(account)" :emojis="account.emojis" />
<p op50>
{{ getAccountHandle(account) }}
</p>
@ -74,7 +74,7 @@ function getFieldNameIcon(fieldName: string) {
</div>
</div>
<div v-if="account.note">
<ContentRichSetup text-4 text-gray :content="account.note" :emojis="account.emojis" />
<ContentRich text-4 text-gray :content="account.note" :emojis="account.emojis" />
</div>
<div flex flex-wrap gap-4>
<div v-for="field in fields" :key="field.name" flex="~ gap-1" items-center>
@ -82,7 +82,7 @@ function getFieldNameIcon(fieldName: string) {
<div v-else op50 uppercase text-xs font-bold>
{{ field.name }} |
</div>
<ContentRichSetup text-sm filter-saturate-0 :content="field.value" />
<ContentRich text-sm filter-saturate-0 :content="field.value" />
</div>
</div>
<div flex gap-5>

View file

@ -22,6 +22,6 @@ defineProps<{
{{ account.followersCount }} Followers
</NuxtLink>
</div>
<ContentRichSetup text-4 text-gray :content="account.note" :emojis="account.emojis" />
<ContentRich text-4 text-gray :content="account.note" :emojis="account.emojis" />
</div>
</template>

View file

@ -19,7 +19,7 @@ const accountHandle = $(useAccountHandle(account, fullServer))
</NuxtLink>
</div>
<NuxtLink flex flex-col :to="link ? getAccountPath(account) : null">
<ContentRichSetup font-bold hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
<ContentRich font-bold hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
<p op35 text-sm>
{{ accountHandle }}
</p>

View file

@ -10,6 +10,6 @@ const { link = true } = defineProps<{
<template>
<NuxtLink :to="link ? getAccountPath(account) : undefined" min-w-0 flex gap-1 items-center>
<AccountAvatar :account="account" w-5 h-5 />
<ContentRichSetup hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
<ContentRich hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
</NuxtLink>
</template>

View file

@ -8,6 +8,6 @@ defineProps<{
<template>
<NuxtLink :to="getAccountPath(account)">
<ContentRichSetup font-bold :content="getDisplayName(account)" :emojis="account.emojis" />
<ContentRich font-bold :content="getDisplayName(account)" :emojis="account.emojis" />
</NuxtLink>
</template>

View file

@ -14,7 +14,7 @@ const accountHandle = $(useAccountHandle(account))
:to="link ? getAccountPath(account) : undefined"
flex="~ col" min-w-0 md:flex="~ row gap-2" md:items-center
>
<ContentRichSetup font-bold break-words hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
<ContentRich font-bold break-words hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
<p op35 text-sm>
{{ accountHandle }}
</p>

View file

@ -9,7 +9,7 @@ const { translation } = useTranslation(status)
<template>
<div class="status-body" whitespace-pre-wrap break-words>
<ContentRichSetup
<ContentRich
:content="translation.visible ? translation.text : status.content"
:emojis="status.emojis"
/>

View file

@ -0,0 +1,16 @@
import { defineNuxtModule, useNuxt } from '@nuxt/kit'
export default defineNuxtModule({
meta: {
name: 'setup-components',
},
setup() {
const nuxt = useNuxt()
nuxt.hook('components:extend', (components) => {
for (const component of components) {
component.pascalName = component.pascalName.replace(/Setup$/, '')
component.kebabName = component.kebabName.replace(/-setup$/, '')
}
})
},
})

View file

@ -6,6 +6,7 @@ export default defineNuxtConfig({
'@pinia/nuxt',
'@vue-macros/nuxt',
'~/modules/purge-comments',
'~/modules/setup-components',
],
experimental: {
reactivityTransform: true,