Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions app/components/Link/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const props = withDefaults(
'type'?: never
'variant'?: 'button-primary' | 'button-secondary' | 'link'
'size'?: 'small' | 'medium'
'iconSize'?: 'sm' | 'md' | 'lg'

'keyshortcut'?: string

Expand Down Expand Up @@ -51,11 +52,21 @@ const isLinkAnchor = computed(
() => !!props.to && typeof props.to === 'string' && props.to.startsWith('#'),
)

const ICON_SIZE_MAP = {
sm: 'size-3 min-w-3',
md: 'size-4 min-w-4',
lg: 'size-5 min-w-5',
}

/** size is only applicable for button like links */
const isLink = computed(() => props.variant === 'link')
const isButton = computed(() => props.variant !== 'link')
const isButtonSmall = computed(() => props.size === 'small' && props.variant !== 'link')
const isButtonMedium = computed(() => props.size === 'medium' && props.variant !== 'link')

const iconSizeClass = computed(
() => ICON_SIZE_MAP[props.iconSize || (isButtonSmall.value && 'sm') || 'md'],
)
</script>

<template>
Expand Down Expand Up @@ -89,11 +100,7 @@ const isButtonMedium = computed(() => props.size === 'medium' && props.variant !
:aria-keyshortcuts="keyshortcut"
:target="isLinkExternal ? '_blank' : undefined"
>
<span
v-if="classicon"
:class="[isButtonSmall ? 'size-3' : 'size-4', classicon]"
aria-hidden="true"
/>
<span v-if="classicon" class="me-1" :class="[iconSizeClass, classicon]" aria-hidden="true" />
<slot />
<!-- automatically show icon indicating external link -->
<span
Expand Down
17 changes: 11 additions & 6 deletions app/components/Package/Dependencies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const numberFormatter = useNumberFormatter()
:key="dep"
class="flex items-center justify-between py-1 text-sm gap-2"
>
<LinkBase :to="packageRoute(dep)" dir="ltr">
<LinkBase :to="packageRoute(dep)" class="block truncate" dir="ltr">
{{ dep }}
</LinkBase>
<span class="flex items-center gap-1 max-w-[40%]" dir="ltr">
Expand Down Expand Up @@ -125,7 +125,7 @@ const numberFormatter = useNumberFormatter()
</LinkBase>
<LinkBase
:to="packageRoute(dep, version)"
class="truncate"
class="block truncate"
:class="getVersionClass(outdatedDeps[dep])"
:title="outdatedDeps[dep] ? getOutdatedTooltip(outdatedDeps[dep], $t) : version"
>
Expand Down Expand Up @@ -175,7 +175,7 @@ const numberFormatter = useNumberFormatter()
class="flex items-center justify-between py-1 text-sm gap-1 min-w-0"
>
<div class="flex items-center gap-1 min-w-0 flex-1">
<LinkBase :to="packageRoute(peer.name)" class="truncate" dir="ltr">
<LinkBase :to="packageRoute(peer.name)" class="block truncate" dir="ltr">
{{ peer.name }}
</LinkBase>
<TagStatic v-if="peer.optional" :title="$t('package.dependencies.optional')">
Expand All @@ -184,7 +184,7 @@ const numberFormatter = useNumberFormatter()
</div>
<LinkBase
:to="packageRoute(peer.name, peer.version)"
class="truncate"
class="block truncate max-w-[40%]"
:title="peer.version"
dir="ltr"
>
Expand Down Expand Up @@ -236,10 +236,15 @@ const numberFormatter = useNumberFormatter()
:key="dep"
class="flex items-center justify-between py-1 text-sm gap-2"
>
<LinkBase :to="packageRoute(dep)" class="truncate" dir="ltr">
<LinkBase :to="packageRoute(dep)" class="block truncate" dir="ltr">
{{ dep }}
</LinkBase>
<LinkBase :to="packageRoute(dep, version)" class="truncate" :title="version" dir="ltr">
<LinkBase
:to="packageRoute(dep, version)"
class="block truncate"
:title="version"
dir="ltr"
>
{{ version }}
</LinkBase>
</li>
Expand Down
17 changes: 11 additions & 6 deletions app/components/Package/Versions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
<div>
<LinkBase
:to="versionRoute(row.primaryVersion.version)"
class="text-sm"
class="text-sm block truncate"
:class="
row.primaryVersion.deprecated ? 'text-red-400 hover:text-red-300' : undefined
"
Expand All @@ -369,6 +369,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
: row.primaryVersion.version
"
:classicon="row.primaryVersion.deprecated ? 'i-carbon-warning-hex' : undefined"
icon-size="sm"
>
<span dir="ltr">
{{ row.primaryVersion.version }}
Expand Down Expand Up @@ -414,14 +415,15 @@ function getTagVersions(tag: string): VersionDisplay[] {
<div class="flex items-center justify-between gap-2">
<LinkBase
:to="versionRoute(v.version)"
class="text-xs truncate"
class="text-xs block truncate"
:class="v.deprecated ? 'text-red-400 hover:text-red-300' : undefined"
:title="
v.deprecated
? $t('package.versions.deprecated_title', { version: v.version })
: v.version
"
:classicon="v.deprecated ? 'i-carbon-warning-hex' : undefined"
icon-size="sm"
>
<span dir="ltr">
{{ v.version }}
Expand Down Expand Up @@ -511,7 +513,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
<div class="flex items-center justify-between gap-2">
<LinkBase
:to="versionRoute(row.primaryVersion.version)"
class="text-xs truncate"
class="text-xs block truncate"
:class="
row.primaryVersion.deprecated ? 'text-red-400 hover:text-red-300' : undefined
"
Expand All @@ -523,6 +525,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
: row.primaryVersion.version
"
:classicon="row.primaryVersion.deprecated ? 'i-carbon-warning-hex' : undefined"
icon-size="sm"
>
<span dir="ltr">
{{ row.primaryVersion.version }}
Expand Down Expand Up @@ -583,7 +586,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
<LinkBase
v-if="group.versions[0]?.version"
:to="versionRoute(group.versions[0]?.version)"
class="text-xs truncate"
class="text-xs block truncate"
:class="
group.versions[0]?.deprecated
? 'text-red-400 hover:text-red-300'
Expand All @@ -599,6 +602,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
:classicon="
group.versions[0]?.deprecated ? 'i-carbon-warning-hex' : undefined
"
icon-size="sm"
>
<span dir="ltr">
{{ group.versions[0]?.version }}
Expand Down Expand Up @@ -644,7 +648,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
<LinkBase
v-if="group.versions[0]?.version"
:to="versionRoute(group.versions[0]?.version)"
class="text-xs truncate"
class="text-xs block truncate"
:class="
group.versions[0]?.deprecated
? 'text-red-400 hover:text-red-300'
Expand All @@ -660,6 +664,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
:classicon="
group.versions[0]?.deprecated ? 'i-carbon-warning-hex' : undefined
"
icon-size="sm"
>
<span dir="ltr">
{{ group.versions[0]?.version }}
Expand Down Expand Up @@ -703,7 +708,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
<div class="flex items-center justify-between gap-2">
<LinkBase
:to="versionRoute(v.version)"
class="text-xs truncate"
class="text-xs block truncate"
:class="v.deprecated ? 'text-red-400 hover:text-red-300' : undefined"
:title="
v.deprecated
Expand Down
Loading