diff --git a/CHDataManagement/Page Elements/ContentElements/AudioPlayer/AudioPlayer.swift b/CHDataManagement/Page Elements/ContentElements/AudioPlayer/AudioPlayer.swift index 614e372..433deea 100644 --- a/CHDataManagement/Page Elements/ContentElements/AudioPlayer/AudioPlayer.swift +++ b/CHDataManagement/Page Elements/ContentElements/AudioPlayer/AudioPlayer.swift @@ -12,7 +12,7 @@ struct AudioPlayer: HtmlProducer {
 
\(playingText)
-
+
\(Icon.AudioPlayer.Playlist.usageString)
""" } @@ -47,12 +47,12 @@ struct AudioPlayer: HtmlProducer { private var controls: String { """
- + <\(Icon.AudioPlayer.Previous.usageContent)
- - + \(Icon.AudioPlayer.Play.usageContent) + \(Icon.AudioPlayer.Pause.usageContent)
- + \(Icon.AudioPlayer.Next.usageContent)
""" } @@ -62,7 +62,7 @@ struct AudioPlayer: HtmlProducer {
\(playlistText)
-
+
\(Icon.AudioPlayer.Close.usageString)
""" @@ -80,12 +80,12 @@ struct AudioPlayer: HtmlProducer {
- + \(Icon.AudioPlayer.Previous.usageContent)
- - + \(Icon.AudioPlayer.Play.usageContent) + \(Icon.AudioPlayer.Pause.usageContent)
- + \(Icon.AudioPlayer.Next.usageContent)
diff --git a/CHDataManagement/Page Elements/ContentElements/AudioPlayer/SingleFilePlayer.swift b/CHDataManagement/Page Elements/ContentElements/AudioPlayer/SingleFilePlayer.swift index 5801bea..151bdcd 100644 --- a/CHDataManagement/Page Elements/ContentElements/AudioPlayer/SingleFilePlayer.swift +++ b/CHDataManagement/Page Elements/ContentElements/AudioPlayer/SingleFilePlayer.swift @@ -6,8 +6,8 @@ struct SingleFilePlayer: HtmlProducer { result += "
" result += "
" result += "
" - result += "" - result += "" + result += "\(Icon.AudioPlayer.Play.usageString)" + result += "\(Icon.AudioPlayer.Pause.usageString)" result += "
" result += "" result += "
" diff --git a/CHDataManagement/Page Elements/ContentElements/ContentButtons.swift b/CHDataManagement/Page Elements/ContentElements/ContentButtons.swift index 8872492..7ec7498 100644 --- a/CHDataManagement/Page Elements/ContentElements/ContentButtons.swift +++ b/CHDataManagement/Page Elements/ContentElements/ContentButtons.swift @@ -42,7 +42,7 @@ struct ContentButtons { let linkText = item.filePath.map { " href='\($0)'" } ?? "" let onClickText = item.onClickText.map { " onClick='\($0)'" } ?? "" result += "" - result += "\(item.text)" + result += "\(item.icon.usageString)\(item.text)" result += "" } } diff --git a/CHDataManagement/Page Elements/ContentElements/ContentLabels.swift b/CHDataManagement/Page Elements/ContentElements/ContentLabels.swift index 4a004f4..40cd590 100644 --- a/CHDataManagement/Page Elements/ContentElements/ContentLabels.swift +++ b/CHDataManagement/Page Elements/ContentElements/ContentLabels.swift @@ -13,7 +13,9 @@ struct ContentLabels: HtmlProducer { } result += "
" for label in labels { - result += "
\(label.value)
" + result += "
" + result += label.icon.usageString + result += "\(label.value)
" } result += "
" } diff --git a/CHDataManagement/Page Elements/ContentElements/Icons/AudioPlayerIcons.swift b/CHDataManagement/Page Elements/ContentElements/Icons/AudioPlayerIcons.swift index 73c710b..bf8a259 100644 --- a/CHDataManagement/Page Elements/ContentElements/Icons/AudioPlayerIcons.swift +++ b/CHDataManagement/Page Elements/ContentElements/Icons/AudioPlayerIcons.swift @@ -1,55 +1,78 @@ -struct AudioPlayerPlaylistIcon: ContentIcon { +extension Icon { - static let name = "icon-playlist" + enum AudioPlayer { - static let content = """ - - """ -} - -struct AudioPlayerCloseIcon: ContentIcon { - - static let name = "icon-close" - - static let content = """ - - """ -} - -struct AudioPlayerPauseIcon: ContentIcon { - - static let name = "icon-pause" - - static let content = """ - - """ -} - -struct AudioPlayerPlayIcon: ContentIcon { - - static let name = "icon-play" - - static let content = """ - - - """ -} - -struct AudioPlayerPreviousIcon: ContentIcon { - - static let name = "icon-previous" - - static let content = """ - - """ -} - -struct AudioPlayerNextIcon: ContentIcon { - - static let name = "icon-next" - - static let content = """ - - """ + struct Playlist: ContentIcon { + + static let id = "icon-playlist" + + static let attributes = "viewBox='0 0 28 20'" + + static let content = + """ + + """ + } + + struct Close: ContentIcon { + + static let id = "icon-close" + + static let attributes = "viewBox='0 0 18 18'" + + static let content = + """ + + """ + } + + struct Pause: ContentIcon { + + static let id = "icon-pause" + + static let attributes = "viewBox='0 0 85 85'" + + static let content = + """ + + """ + } + + struct Play: ContentIcon { + + static let id = "icon-play" + + static let attributes = "viewBox='0 0 85 85'" + + static let content = + """ + + """ + } + + struct Previous: ContentIcon { + + static let id = "icon-previous" + + static let attributes = "viewBox='0 0 53 53'" + + static let content = + """ + + """ + } + + struct Next: ContentIcon { + + static let id = "icon-next" + + static let attributes = "viewBox='0 0 53 53'" + + static let content = + """ + + """ + } + } } diff --git a/CHDataManagement/Page Elements/ContentElements/Icons/ButtonIcons.swift b/CHDataManagement/Page Elements/ContentElements/Icons/ButtonIcons.swift index 46bc1f5..e99d14c 100644 --- a/CHDataManagement/Page Elements/ContentElements/Icons/ButtonIcons.swift +++ b/CHDataManagement/Page Elements/ContentElements/Icons/ButtonIcons.swift @@ -1,11 +1,15 @@ extension Icon { + struct ArrowDown: ContentIcon { - static let name = "icon-download" + static let id = "icon-download" - static let content = """ - + static let attributes = "viewBox='0 0 40 40'" + + static let content = + """ + """ } } @@ -14,10 +18,13 @@ extension Icon { struct ArrowRight: ContentIcon { - static let name = "icon-external" + static let id = "icon-external" - static let content = """ - + static let attributes = "viewBox='0 0 16 16'" + + static let content = + """ + """ } } @@ -26,10 +33,13 @@ extension Icon { struct Git: ContentIcon { - static let name = "icon-git" + static let id = "icon-git" - static let content = """ - + static let attributes = "viewBox='0 0 16 16'" + + static let content = + """ + """ } } @@ -38,10 +48,13 @@ extension Icon { struct Play: ContentIcon { - static let name = "icon-play-circle" + static let id = "icon-play-circle" - static let content = """ - + static let attributes = "viewBox='0 0 1000 1000'" + + static let content = + """ + """ } } diff --git a/CHDataManagement/Page Elements/ContentElements/Icons/ContentIcon.swift b/CHDataManagement/Page Elements/ContentElements/Icons/ContentIcon.swift index 951b9ca..cc6e4b0 100644 --- a/CHDataManagement/Page Elements/ContentElements/Icons/ContentIcon.swift +++ b/CHDataManagement/Page Elements/ContentElements/Icons/ContentIcon.swift @@ -1,18 +1,35 @@ protocol ContentIcon { - static var name: String { get } + static var id: String { get } + + static var attributes: String { get } static var content: String { get } } extension ContentIcon { - var name: String { - Self.name + var id: String { + Self.id } var content: String { Self.content } } + +extension ContentIcon { + + static var svgString: String { + "\(content)" + } + + static var usageString: String { + "\(usageContent)" + } + + static var usageContent: String { + "" + } +} diff --git a/CHDataManagement/Page Elements/ContentElements/Icons/GeneralIcons.swift b/CHDataManagement/Page Elements/ContentElements/Icons/GeneralIcons.swift index fa31a2c..c5e7a4b 100644 --- a/CHDataManagement/Page Elements/ContentElements/Icons/GeneralIcons.swift +++ b/CHDataManagement/Page Elements/ContentElements/Icons/GeneralIcons.swift @@ -3,10 +3,13 @@ extension Icon { struct Calendar: ContentIcon { - static let name = "icon-calendar" + static let id = "icon-calendar" - static let content = """ - + static let attributes = "viewBox='0 0 141 146' fill='currentColor'" + + static let content = + """ + """ } } @@ -15,10 +18,13 @@ extension Icon { struct ClockFill: ContentIcon { - static let name = "icon-clock-fill" + static let id = "icon-clock-fill" - static let content = """ - + static let attributes = "viewBox='0 0 16 16' fill='currentColor'" + + static let content = + """ + """ } } @@ -27,10 +33,13 @@ extension Icon { struct File: ContentIcon { - static let name = "icon-file" + static let id = "icon-file" - static let content = """ - + static let attributes = "viewBox='0 0 16 16' fill='currentColor'" + + static let content = + """ + """ } } @@ -39,10 +48,13 @@ extension Icon { struct Globe: ContentIcon { - static let name = "icon-globe" + static let id = "icon-globe" - static let content = """ - + static let attributes = "viewBox='0 0 16 16' fill='currentColor'" + + static let content = + """ + """ } } @@ -51,10 +63,13 @@ extension Icon { struct Location: ContentIcon { - static let name = "icon-location" + static let id = "icon-location" - static let content = """ - + static let attributes = "viewBox='0 0 16 16' fill='currentColor'" + + static let content = + """ + """ } } @@ -63,10 +78,13 @@ extension Icon { struct Poster: ContentIcon { - static let name = "icon-poster" + static let id = "icon-poster" - static let content = """ - + static let attributes = "viewBox='0 0 16 16' fill='currentColor'" + + static let content = + """ + """ } } @@ -75,10 +93,13 @@ extension Icon { struct Video: ContentIcon { - static let name = "icon-video" + static let id = "icon-video" - static let content = """ - + static let attributes = "viewBox='0 0 122.9 111.3' fill='currentColor'" + + static let content = + """ + """ } } diff --git a/CHDataManagement/Page Elements/ContentElements/Icons/ImageCompareIcons.swift b/CHDataManagement/Page Elements/ContentElements/Icons/ImageCompareIcons.swift index 9371fa2..97b16a9 100644 --- a/CHDataManagement/Page Elements/ContentElements/Icons/ImageCompareIcons.swift +++ b/CHDataManagement/Page Elements/ContentElements/Icons/ImageCompareIcons.swift @@ -3,10 +3,13 @@ extension Icon { struct LeftRightArrow: ContentIcon { - static let name = "left-right-arrow" + static let id = "left-right-arrow" - static let content = """ - + static let attributes = "viewBox='0 0 100 100'" + + static let content = + """ + """ } } diff --git a/CHDataManagement/Page Elements/ContentElements/Icons/PageIcon.swift b/CHDataManagement/Page Elements/ContentElements/Icons/PageIcon.swift index fd62a72..6b3e8cf 100644 --- a/CHDataManagement/Page Elements/ContentElements/Icons/PageIcon.swift +++ b/CHDataManagement/Page Elements/ContentElements/Icons/PageIcon.swift @@ -59,21 +59,21 @@ enum PageIcon: String, CaseIterable { var icon: ContentIcon.Type { switch self { - case .statisticsTime: return StatisticsTimeIcon.self - case .statisticsElevationUp: return StatisticsElevationUpIcon.self - case .statisticsElevationDown: return StatisticsElevationDownIcon.self - case .statisticsDistance: return StatisticsDistanceIcon.self - case .statisticsEnergy: return StatisticsEnergyIcon.self + case .statisticsTime: return Icon.Statistics.Time.self + case .statisticsElevationUp: return Icon.Statistics.ElevationUp.self + case .statisticsElevationDown: return Icon.Statistics.ElevationDown.self + case .statisticsDistance: return Icon.Statistics.Distance.self + case .statisticsEnergy: return Icon.Statistics.Energy.self case .buttonDownload: return Icon.ArrowDown.self case .buttonExternalLink: return Icon.ArrowRight.self case .buttonGitLink: return Icon.Git.self case .buttonPlay: return Icon.Play.self - case .audioPlayerPlaylist: return AudioPlayerPlaylistIcon.self - case .audioPlayerClose: return AudioPlayerCloseIcon.self - case .audioPlayerPlay: return AudioPlayerPlayIcon.self - case .audioPlayerPause: return AudioPlayerPauseIcon.self - case .audioPlayerPrevious: return AudioPlayerPreviousIcon.self - case .audioPlayerNext: return AudioPlayerNextIcon.self + case .audioPlayerPlaylist: return Icon.AudioPlayer.Playlist.self + case .audioPlayerClose: return Icon.AudioPlayer.Close.self + case .audioPlayerPlay: return Icon.AudioPlayer.Play.self + case .audioPlayerPause: return Icon.AudioPlayer.Pause.self + case .audioPlayerPrevious: return Icon.AudioPlayer.Previous.self + case .audioPlayerNext: return Icon.AudioPlayer.Next.self case .calendar: return Icon.Calendar.self case .clockFill: return Icon.ClockFill.self case .file: return Icon.File.self @@ -85,12 +85,44 @@ enum PageIcon: String, CaseIterable { } } + var name: String { + switch self { + case .calendar: "Calendar" + case .clockFill: "ClockFill" + case .file: "File" + case .globe: "Globe" + case .location: "Location" + case .poster: "Poster" + case .video: "Video" + case .leftRightArrow: "LeftRightArrow" + case .buttonExternalLink: "Button: External Link" + case .buttonGitLink: "Button: Git Link" + case .buttonPlay: "Button: Play" + case .audioPlayerPlaylist: "Audio Player: Playlist" + case .audioPlayerClose: "Audio Player: Close" + case .audioPlayerPlay: "Audio Player: Play" + case .audioPlayerPause: "Audio Player: Pause" + case .audioPlayerPrevious: "Audio Player: Previous" + case .audioPlayerNext: "Audio Player: Next" + case .buttonDownload: "Button: Download" + case .statisticsTime: "Time" + case .statisticsElevationUp: "Elevation Up" + case .statisticsElevationDown: "Elevation Down" + case .statisticsDistance: "Distance" + case .statisticsEnergy: "Energy / Calories" + } + } + var svgString: String { icon.content } - var name: String { - icon.name + var id: String { + icon.id + } + + var usageString: String { + icon.usageString } } diff --git a/CHDataManagement/Page Elements/ContentElements/Icons/StatisticsIcons.swift b/CHDataManagement/Page Elements/ContentElements/Icons/StatisticsIcons.swift index 27c1278..802e4ff 100644 --- a/CHDataManagement/Page Elements/ContentElements/Icons/StatisticsIcons.swift +++ b/CHDataManagement/Page Elements/ContentElements/Icons/StatisticsIcons.swift @@ -1,45 +1,66 @@ -struct StatisticsTimeIcon: ContentIcon { +extension Icon { - static let name = "icon-clock" + enum Statistics { - static let content = """ - - """ -} - -struct StatisticsElevationUpIcon: ContentIcon { - - static let name = "icon-elevation-up" - - static let content = """ - - """ -} - -struct StatisticsElevationDownIcon: ContentIcon { - - static let name = "icon-elevation-down" - - static let content = """ - - """ -} - -struct StatisticsDistanceIcon: ContentIcon { - - static let name = "icon-distance" - - static let content = """ - - """ -} - -struct StatisticsEnergyIcon: ContentIcon { - - static let name = "icon-energy" - - static let content = """ - - """ + struct Time: ContentIcon { + + static let id = "icon-clock" + + static let attributes = "viewBox='0 0 16 16' width='16' height='16'" + + static let content = + """ + + """ + } + + struct ElevationUp: ContentIcon { + + static let id = "icon-elevation-up" + + static let attributes = "width='16' height='16'" + + static let content = + """ + + """ + } + + struct ElevationDown: ContentIcon { + + static let id = "icon-elevation-down" + + static let attributes = "width='16' height='16'" + + static let content = + """ + + """ + } + + struct Distance: ContentIcon { + + static let id = "icon-distance" + + static let attributes = "width='16' height='16'" + + static let content = + """ + + """ + } + + struct Energy: ContentIcon { + + static let id = "icon-energy" + + static let attributes = "width='16' height='16'" + + static let content = + """ + + """ + } + } } diff --git a/CHDataManagement/Page Elements/ContentElements/ImageCompare.swift b/CHDataManagement/Page Elements/ContentElements/ImageCompare.swift index c61737c..28b859e 100644 --- a/CHDataManagement/Page Elements/ContentElements/ImageCompare.swift +++ b/CHDataManagement/Page Elements/ContentElements/ImageCompare.swift @@ -14,7 +14,7 @@ struct ImageCompare: HtmlProducer { result += "
\(left.content)
" result += "
\(right.content)
" result += "
" - result += "" + result += Icon.LeftRightArrow.usageString result += "
" // Close drag, image-compare } }