Skip to content

Commit

Permalink
feat: new prop target for service
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Jan 26, 2024
1 parent c49b24d commit feea7fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/service/base/Index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="p-4 flex gap-4">
<div class="flex-shrink-0 flex">
<a :href="link" class="self-center w-16 h-16 overflow-hidden rounded-2xl border border-fg/10 dark:border-fg/15">
<a :href="link" :target="target" class="self-center w-16 h-16 overflow-hidden rounded-2xl border border-fg/10 dark:border-fg/15">
<slot name="icon">
<ServiceBaseIcon v-if="icon" v-bind="icon" />
</slot>
Expand All @@ -10,7 +10,7 @@
<div>
<h3 class="text-lg mt-1 font-semibold line-clamp-1 flex gap-2 items-center">
<slot name="title">
<a :href="link">{{ title }}</a>
<a :href="link" :target="target">{{ title }}</a>
</slot>
<slot v-if="props?.status" name="status">
<ServiceBaseStatus :ping="data?.ping" />
Expand All @@ -31,6 +31,7 @@ import type { BaseService } from '~/types'
import { useServiceData } from '~/composables/services'
const props = defineProps<BaseService>()
const target = computed(() => props.target || '_blank')
// Right now, queries for "base" are only needed for statuses.
// When the situation will change it is necessary to remove/add condition for "immediate"
Expand Down
1 change: 1 addition & 0 deletions server/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function validateConfigSchema(config: any) {
title: z.string(),
description: z.string().optional(),
link: z.string(),
target: z.string().optional(),
icon: icon.optional(),
status: status.optional(),
type: z.string().optional(),
Expand Down
1 change: 1 addition & 0 deletions types/services.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface BaseService {
title: string
description?: string
link: string
target?: '_blank' | '_self' | '_parent' | '_top'
icon?: ServiceIcon
status?: ServiceStatus
options?: Record<string, string | number | boolean>
Expand Down

0 comments on commit feea7fe

Please sign in to comment.