119 lines
2.4 KiB
TypeScript
119 lines
2.4 KiB
TypeScript
declare module 'content/routes.js' {
|
|
/**
|
|
* Defines the structure of the warning modal that shows when a route has a content warning of some sort.
|
|
*/
|
|
export type WarningModal = {
|
|
prompt: string
|
|
leave: {
|
|
url: string,
|
|
text: string,
|
|
},
|
|
acknowledge: string,
|
|
remember: string,
|
|
}
|
|
|
|
/**
|
|
* Defines the available `views` that can be used to set up routes.
|
|
* Each `Template` has different configuration options
|
|
*/
|
|
type Template =
|
|
| 'markdown'
|
|
| 'project-list'
|
|
| 'gallery-list'
|
|
|
|
/**
|
|
* Defines the shared options for a route
|
|
*/
|
|
type SharedRouteDefinition = {
|
|
id: string
|
|
stylesheetUrls: string[]
|
|
template: Template
|
|
title: string
|
|
warning: boolean | WarningModal
|
|
}
|
|
|
|
/**
|
|
* Defines a content-based route
|
|
*/
|
|
type ContentfulRouteDefintion = SharedRouteDefinition & {
|
|
content: string
|
|
}
|
|
|
|
/**
|
|
* Defines a config-based route
|
|
*/
|
|
type ConfigfulRouteDefinition = SharedRouteDefinition & {
|
|
config: string
|
|
}
|
|
|
|
/**
|
|
* Defines the config for a route using the `markdown` {@link Template}
|
|
*/
|
|
type MarkdownDefinition = ContentfulRouteDefintion & {
|
|
template: 'markdown'
|
|
}
|
|
|
|
/**
|
|
* Defines the config for a route using the `project-list` {@link Template}
|
|
*/
|
|
type ProjectListDefinition = ConfigfulRouteDefinition & {
|
|
template: 'project-list'
|
|
view: {
|
|
stylesheetUrls: string[]
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Defines the config for a route using the `gallery-list` {@link Template}
|
|
*/
|
|
type GalleryListDefinition = ConfigfulRouteDefinition & {
|
|
template: 'gallery-list'
|
|
view: {
|
|
stylesheetUrls: string[]
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Defines all available route definitions
|
|
*/
|
|
type RouteDefinition =
|
|
| MarkdownDefinition
|
|
| ProjectListDefinition
|
|
| GalleryListDefinition
|
|
|
|
/**
|
|
* Defines the collection of routes the app uses
|
|
*/
|
|
type RouteCollection = { [key: string]: RouteDefinition }
|
|
|
|
/**
|
|
* The routes the app uses
|
|
*/
|
|
const routes: RouteCollection
|
|
|
|
/**
|
|
* Defines an entry in the app header.
|
|
* Optionally recursive by defining children instead of path.
|
|
*/
|
|
type HeaderEntry = {
|
|
displayName: string
|
|
} & ({
|
|
path: string
|
|
} | {
|
|
children: HeaderEntry[]
|
|
})
|
|
|
|
/**
|
|
* Defines global values for the site.
|
|
*/
|
|
type SiteGlobals = {
|
|
header: HeaderEntry[],
|
|
id: string
|
|
warning: WarningModal
|
|
}
|
|
|
|
/**
|
|
* Global values the site uses.
|
|
*/
|
|
const siteGlobals: SiteGlobals
|
|
}
|