Skip to content

Commit 3f68e08

Browse files
committed
feat: also add subheading to chart modal
1 parent c7126fe commit 3f68e08

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

app/components/CollapsibleSection.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ useHead({
103103
/>
104104
</button>
105105

106-
<div>
106+
<span>
107107
<LinkBase :to="`#${id}`">
108108
{{ title }}
109109
</LinkBase>
110110
<span v-if="subtitle" class="block text-2xs normal-case tracking-normal opacity-70">{{
111111
subtitle
112112
}}</span>
113-
</div>
113+
</span>
114114
</component>
115115

116116
<!-- Actions slot for buttons or other elements -->

app/components/Modal.client.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
const props = defineProps<{
33
modalTitle: string
4+
modalSubtitle?: string
45
}>()
56
67
const dialogRef = useTemplateRef('dialogRef')
@@ -50,9 +51,12 @@ defineExpose({
5051
>
5152
<!-- Modal top header section -->
5253
<div class="flex items-center justify-between mb-6">
53-
<h2 :id="modalTitleId" class="font-mono text-lg font-medium">
54-
{{ modalTitle }}
55-
</h2>
54+
<div>
55+
<h2 :id="modalTitleId" class="font-mono text-lg font-medium">
56+
{{ modalTitle }}
57+
</h2>
58+
<p v-if="modalSubtitle" class="text-xs text-fg-subtle">{{ modalSubtitle }}</p>
59+
</div>
5660
<ButtonBase
5761
type="button"
5862
:aria-label="$t('common.close')"

app/components/Package/ChartModal.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
const props = defineProps<{
33
modalTitle?: string
4+
modalSubtitle?: string
45
}>()
56
67
const emit = defineEmits<{
@@ -11,6 +12,7 @@ const emit = defineEmits<{
1112
<template>
1213
<Modal
1314
:modalTitle="modalTitle ?? $t('package.trends.title')"
15+
:modalSubtitle="modalSubtitle"
1416
id="chart-modal"
1517
class="h-full sm:h-min sm:border sm:border-border sm:rounded-lg shadow-xl sm:max-h-[90vh] sm:max-w-3xl"
1618
@transitioned="emit('transitioned')"

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ const modalTitle = computed(() => {
2828
return $t('package.trends.items.downloads')
2929
})
3030
31+
const modalSubtitle = computed(() => {
32+
const facet = route.query.facet as string | undefined
33+
if (facet === 'likes' || facet === 'contributors') return undefined
34+
return $t('package.downloads.subtitle')
35+
})
36+
3137
const isChartModalOpen = shallowRef<boolean>(false)
3238
3339
function handleModalClose() {
@@ -355,6 +361,7 @@ const config = computed<VueUiSparklineConfig>(() => {
355361
<PackageChartModal
356362
v-if="isChartModalOpen && hasWeeklyDownloads"
357363
:modal-title="modalTitle"
364+
:modal-subtitle="modalSubtitle"
358365
@close="handleModalClose"
359366
@transitioned="handleModalTransitioned"
360367
>

0 commit comments

Comments
 (0)