PreStyling Layouts & Components

This commit is contained in:
2026-09-24 09:58:25 +02:00
parent fc38a1aafe
commit 356ccedc01
39 changed files with 1212 additions and 96 deletions

View File

@@ -1,16 +1,24 @@
export const FIGURE_SIZES = [
{
label: 'Inline',
value: 'inline',
},
{
label: 'Wide',
value: 'wide',
},
{
label: 'Full',
value: 'full',
},
]
{ label: 'Inline', value: 'inline' },
{ label: 'Wide', value: 'wide' },
{ label: 'Full', value: 'full' },
] as const
export const IMAGE_EFFECTS = [
{ label: 'None', value: 'none' },
{ label: 'Xeroxed', value: 'xeroxed' },
] as const
export const ASPECT_RATIOS = [
{ label: 'Original', value: 'original' },
{ label: 'Panorama (21:9)', value: '21-9' },
{ label: 'Wide (16:9)', value: '16-9' },
{ label: 'Photo (3:2)', value: '3-2' },
{ label: 'Classic (4:3)', value: '4-3' },
{ label: 'Square (1:1)', value: '1-1' },
{ label: 'Portrait (4:5)', value: '4-5' },
] as const
export type FigureSize = (typeof FIGURE_SIZES)[number]['value']
export type ImageEffect = (typeof IMAGE_EFFECTS)[number]['value']
export type AspectRatio = (typeof ASPECT_RATIOS)[number]['value']

View File

@@ -11,10 +11,6 @@ export const STATUS_OPTIONS = [
label: 'Unlisted',
value: 'unlisted',
},
{
label: 'Archived',
value: 'archived',
},
] as const
export type Status = (typeof STATUS_OPTIONS)[number]['value']

View File

@@ -5,6 +5,21 @@ const DISPLAY = new Intl.DateTimeFormat('en-GB', {
year: 'numeric',
})
const MONTHS = [
'JAN',
'FEB',
'MAR',
'APR',
'MAY',
'JUN',
'JUL',
'AUG',
'SEP',
'OCT',
'NOV',
'DEC',
] as const
export function parseDate(value: string | null): Date | null {
if (!value) return null
const date = new Date(/(z|[+-]\d\d:\d\d)$/i.test(value) ? value : `${value}Z`)
@@ -14,3 +29,14 @@ export function parseDate(value: string | null): Date | null {
export const formatDate = (date: Date): string => DISPLAY.format(date)
export const isoDate = (date: Date): string => date.toISOString().slice(0, 10)
export const toMilitaryDTG = (datestring: Date, timeZone = 'A'): string => {
const d = new Date(datestring)
const day = d.getUTCDate().toString().padStart(2, '0')
const hours = d.getUTCHours().toString().padStart(2, '0')
const minutes = d.getUTCMinutes().toString().padStart(2, '0')
const month = MONTHS[d.getUTCMonth()]
const year = d.getUTCFullYear().toString().slice(-2)
return `${day}${hours}${minutes}${timeZone}${month}${year}`
}

View File

@@ -0,0 +1,7 @@
import type { Article } from './types'
export function trailOf(article: Article): Article[] {
const trail: Article[] = []
for (let node: Article | null = article; node; node = node.parent) trail.unshift(node)
return trail
}