Skip to content

Commit feea7fe

Browse files
author
hywax
committed
feat: new prop target for service
1 parent c49b24d commit feea7fe

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Diff for: components/service/base/Index.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="p-4 flex gap-4">
33
<div class="flex-shrink-0 flex">
4-
<a :href="link" class="self-center w-16 h-16 overflow-hidden rounded-2xl border border-fg/10 dark:border-fg/15">
4+
<a :href="link" :target="target" class="self-center w-16 h-16 overflow-hidden rounded-2xl border border-fg/10 dark:border-fg/15">
55
<slot name="icon">
66
<ServiceBaseIcon v-if="icon" v-bind="icon" />
77
</slot>
@@ -10,7 +10,7 @@
1010
<div>
1111
<h3 class="text-lg mt-1 font-semibold line-clamp-1 flex gap-2 items-center">
1212
<slot name="title">
13-
<a :href="link">{{ title }}</a>
13+
<a :href="link" :target="target">{{ title }}</a>
1414
</slot>
1515
<slot v-if="props?.status" name="status">
1616
<ServiceBaseStatus :ping="data?.ping" />
@@ -31,6 +31,7 @@ import type { BaseService } from '~/types'
3131
import { useServiceData } from '~/composables/services'
3232
3333
const props = defineProps<BaseService>()
34+
const target = computed(() => props.target || '_blank')
3435
3536
// Right now, queries for "base" are only needed for statuses.
3637
// When the situation will change it is necessary to remove/add condition for "immediate"

Diff for: server/utils/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export function validateConfigSchema(config: any) {
4141
title: z.string(),
4242
description: z.string().optional(),
4343
link: z.string(),
44+
target: z.string().optional(),
4445
icon: icon.optional(),
4546
status: status.optional(),
4647
type: z.string().optional(),

Diff for: types/services.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface BaseService {
1717
title: string
1818
description?: string
1919
link: string
20+
target?: '_blank' | '_self' | '_parent' | '_top'
2021
icon?: ServiceIcon
2122
status?: ServiceStatus
2223
options?: Record<string, string | number | boolean>

0 commit comments

Comments
 (0)