once again change how blog-list is structured
This commit is contained in:
parent
ca91d9fcb5
commit
e4da36a23c
6 changed files with 100 additions and 56 deletions
23
libs/types/src/content/templates/blog-list.d.ts
vendored
23
libs/types/src/content/templates/blog-list.d.ts
vendored
|
@ -1,6 +1,6 @@
|
|||
import type { DateRange } from '../dateRange'
|
||||
import type { EntryTagCollection } from '../entryTag'
|
||||
import type { EntryWithConfig, EntryWithContent } from './shared'
|
||||
import type { ListWithEntries } from './shared'
|
||||
|
||||
/**
|
||||
* This describes aditional information about a blog entry
|
||||
|
@ -8,6 +8,9 @@ import type { EntryWithConfig, EntryWithContent } from './shared'
|
|||
* At minimum, the title should be specified.
|
||||
*/
|
||||
export type BlogEntry = {
|
||||
/**
|
||||
* Specifies the date of the blog entry
|
||||
*/
|
||||
date?: DateRange | string | number
|
||||
/**[Supports Markdown]
|
||||
* Information to summarize an entry
|
||||
|
@ -21,18 +24,22 @@ export type BlogEntry = {
|
|||
* The title of the blog entry
|
||||
*/
|
||||
title: string
|
||||
/**
|
||||
* Information regarding the thumbnail
|
||||
*/
|
||||
thumbnail?: {
|
||||
/**
|
||||
* Sets the inline-styles for the thumbnail
|
||||
*/
|
||||
style: CSSStyleDeclaration
|
||||
}
|
||||
}
|
||||
|
||||
export type BlogEntries = { [key: string]:
|
||||
& EntryWithContent
|
||||
& EntryWithConfig<BlogEntry>
|
||||
/**
|
||||
* URL to the markdown document of the blog entry
|
||||
*/
|
||||
url: string
|
||||
}
|
||||
|
||||
export type BlogList = {
|
||||
entries: BlogEntries
|
||||
tags?: EntryTagCollection
|
||||
removeFromView?: boolean
|
||||
}
|
||||
} & ListWithEntries<BlogEntry>
|
||||
|
|
40
libs/types/src/content/templates/shared.d.ts
vendored
40
libs/types/src/content/templates/shared.d.ts
vendored
|
@ -1,19 +1,33 @@
|
|||
/**
|
||||
* Denotes a listing entry that contains content,
|
||||
* which can be defined either directly in the list
|
||||
* or be defined in a separate file
|
||||
* Defines entries that are already fetched or are embedded directly in the list.
|
||||
* Stored in key-value format where the key is the id of the entry,
|
||||
* and the value is the entry config itself
|
||||
* (defined as `T` based on the type of the entries in the implemented list)
|
||||
*/
|
||||
export type EntryWithContent = {
|
||||
content?: string
|
||||
contentUrl?: string
|
||||
}
|
||||
export type ListEntry<T> = { [key: string]: T }
|
||||
|
||||
/**
|
||||
* Denotes a listing entry that contains config,
|
||||
* which can be defined either directly in the list
|
||||
* or be defined in a separate file
|
||||
* Defines entries that are fetched from remote config files.
|
||||
* Stored in key-value format where the key is the id of the entry,
|
||||
* and the value is the url to the config file.
|
||||
*/
|
||||
export type EntryWithConfig<T> = {
|
||||
config?: T
|
||||
configUrl?: string
|
||||
export type ListRemoteEntries<T> = { [key: string]: string }
|
||||
|
||||
/**
|
||||
* Defines a list-type template that has config entries defined by id.
|
||||
* One of two must be defined: `entries` or `embeddedEntries`.
|
||||
* Both can be defined and used simultaneously.
|
||||
* Note that in the case of an `id` collision
|
||||
* (i.e. both `entries` and `embeddedEntries` have an entry with the same id),
|
||||
* the implemented behavior should pick the `embeddedEntry`
|
||||
*/
|
||||
export type ListWithEntries<T> = {
|
||||
/**
|
||||
* Entries that will be fetched from remote config files
|
||||
*/
|
||||
entries?: ListRemoteEntries
|
||||
/**
|
||||
* Entries that are embedded directly in the list config
|
||||
*/
|
||||
embeddedEntries?: ListEntry
|
||||
}
|
||||
|
|
1
libs/types/src/index.d.ts
vendored
1
libs/types/src/index.d.ts
vendored
|
@ -10,4 +10,5 @@ export * from './content/link'
|
|||
|
||||
export * from './content/templates/blog-list'
|
||||
export * from './content/templates/gallery-list'
|
||||
export * from './content/templates/shared'
|
||||
export * from './content/templates/templateType'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue