2022-08-16 10:39:05 +02:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
final class TemplateFactory {
|
|
|
|
|
|
|
|
let templateFolder: URL
|
|
|
|
|
|
|
|
// MARK: Site Elements
|
|
|
|
|
|
|
|
let backNavigation: BackNavigationTemplate
|
|
|
|
|
|
|
|
let pageHead: PageHeadTemplate
|
|
|
|
|
|
|
|
let topBar: TopBarTemplate
|
|
|
|
|
|
|
|
let overviewSection: OverviewSectionTemplate
|
|
|
|
|
|
|
|
let overviewSectionClean: OverviewSectionCleanTemplate
|
|
|
|
|
|
|
|
let placeholder: PlaceholderTemplate
|
|
|
|
|
|
|
|
// MARK: Thumbnails
|
|
|
|
|
|
|
|
let largeThumbnail: LargeThumbnailTemplate
|
|
|
|
|
|
|
|
let squareThumbnail: SquareThumbnailTemplate
|
|
|
|
|
|
|
|
let smallThumbnail: SmallThumbnailTemplate
|
|
|
|
|
|
|
|
func thumbnail(style: ThumbnailStyle) -> ThumbnailTemplate {
|
|
|
|
switch style {
|
|
|
|
case .large:
|
|
|
|
return largeThumbnail
|
|
|
|
case .square:
|
|
|
|
return squareThumbnail
|
|
|
|
case .small:
|
|
|
|
return smallThumbnail
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-16 12:27:13 +02:00
|
|
|
// MARK: Headers
|
|
|
|
|
|
|
|
let leftHeader: LeftHeaderTemplate
|
2022-08-16 10:39:05 +02:00
|
|
|
|
2022-08-16 12:27:13 +02:00
|
|
|
let centeredHeader: CenteredHeaderTemplate
|
|
|
|
|
|
|
|
// MARK: Pages
|
2022-08-16 10:39:05 +02:00
|
|
|
|
2022-08-16 12:27:13 +02:00
|
|
|
let page: PageTemplate
|
2022-08-16 10:39:05 +02:00
|
|
|
|
2022-08-17 10:36:21 +02:00
|
|
|
let image: PageImageTemplate
|
|
|
|
|
|
|
|
let video: PageVideoTemplate
|
|
|
|
|
2022-08-16 10:39:05 +02:00
|
|
|
// MARK: Init
|
|
|
|
|
|
|
|
init(templateFolder: URL) throws {
|
|
|
|
self.templateFolder = templateFolder
|
|
|
|
self.backNavigation = try .init(in: templateFolder)
|
|
|
|
self.pageHead = try .init(in: templateFolder)
|
|
|
|
self.topBar = try .init(in: templateFolder)
|
|
|
|
self.overviewSection = try .init(in: templateFolder)
|
|
|
|
self.overviewSectionClean = try .init(in: templateFolder)
|
|
|
|
self.placeholder = try .init(in: templateFolder)
|
|
|
|
self.largeThumbnail = try .init(in: templateFolder)
|
|
|
|
self.squareThumbnail = try .init(in: templateFolder)
|
|
|
|
self.smallThumbnail = try .init(in: templateFolder)
|
2022-08-16 12:27:13 +02:00
|
|
|
self.leftHeader = try .init(in: templateFolder)
|
|
|
|
self.centeredHeader = try .init(in: templateFolder)
|
|
|
|
self.page = try .init(in: templateFolder)
|
2022-08-17 10:36:21 +02:00
|
|
|
self.image = try .init(in: templateFolder)
|
|
|
|
self.video = try .init(in: templateFolder)
|
2022-08-16 10:39:05 +02:00
|
|
|
}
|
|
|
|
}
|