Skip to content

Commit

Permalink
Fix SogTimeline
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch committed Aug 28, 2024
1 parent 2013022 commit 7015fdf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 9 additions & 5 deletions components/SogTimeline.global.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,23 @@
</template>

<script setup lang="ts">
import { useData } from '~/types/composables'
import type { ParsedTimelineContent } from '~/types/timeline'
const { locale } = useI18n()
const props = defineProps({
timelineConfig: {
type: String,
default: '',
required: true,
},
})
const timelines = await queryContent(
locale.value,
props.timelineConfig
).find()
const { value: timelines } = await useData(`timeline-${locale}-${props.timelineConfig.replaceAll('/', '-')}`, async () => {
const content = await queryContent(locale.value, ...props.timelineConfig.split('/')).findOne()
return (content as ParsedTimelineContent).timelines
})
const timeline = ref<HTMLElement | null>(null)
const timelineWidth = ref(0)
const isFarLeft = ref(true)
Expand Down
11 changes: 11 additions & 0 deletions types/timeline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { ParsedContent } from "@nuxt/content"

export interface Timeline {
date: string
title: string
text: string
}

export interface ParsedTimelineContent extends ParsedContent {
timelines: Timeline[]
}

0 comments on commit 7015fdf

Please sign in to comment.