diff --git a/Mist.xcodeproj/project.pbxproj b/Mist.xcodeproj/project.pbxproj index f1f29ed..0c4cba4 100644 --- a/Mist.xcodeproj/project.pbxproj +++ b/Mist.xcodeproj/project.pbxproj @@ -27,7 +27,7 @@ 390451DF28573FAA00E0B563 /* Yams in Frameworks */ = {isa = PBXBuildFile; productRef = 390451DE28573FAA00E0B563 /* Yams */; }; 390451E1285740E800E0B563 /* Sequence+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 390451E0285740E800E0B563 /* Sequence+Extension.swift */; }; 390451E528574F0000E0B563 /* CatalogType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 390451E428574F0000E0B563 /* CatalogType.swift */; }; - 390451E72857510C00E0B563 /* TextTag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 390451E62857510B00E0B563 /* TextTag.swift */; }; + 390451E72857510C00E0B563 /* TextRibbon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 390451E62857510B00E0B563 /* TextRibbon.swift */; }; 39148CFC28DD55B300011FF5 /* PathControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39148CFB28DD55B300011FF5 /* PathControl.swift */; }; 39252A77285A849F00956C74 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39252A76285A849F00956C74 /* AppDelegate.swift */; }; 39252A79285A85AF00956C74 /* SettingsInstallersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39252A78285A85AF00956C74 /* SettingsInstallersView.swift */; }; @@ -181,7 +181,7 @@ 390451DB28573F1000E0B563 /* Dictionary+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Dictionary+Extension.swift"; sourceTree = ""; }; 390451E0285740E800E0B563 /* Sequence+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+Extension.swift"; sourceTree = ""; }; 390451E428574F0000E0B563 /* CatalogType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatalogType.swift; sourceTree = ""; }; - 390451E62857510B00E0B563 /* TextTag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextTag.swift; sourceTree = ""; }; + 390451E62857510B00E0B563 /* TextRibbon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextRibbon.swift; sourceTree = ""; }; 39148CFB28DD55B300011FF5 /* PathControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PathControl.swift; sourceTree = ""; }; 39252A76285A849F00956C74 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39252A78285A85AF00956C74 /* SettingsInstallersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsInstallersView.swift; sourceTree = ""; }; @@ -525,7 +525,7 @@ 390451C92856F1D300E0B563 /* ScaledImage.swift */, 390451CB2856F23100E0B563 /* ScaledSystemImage.swift */, 39252A82285ACBF200956C74 /* TextFieldStepperView.swift */, - 390451E62857510B00E0B563 /* TextTag.swift */, + 390451E62857510B00E0B563 /* TextRibbon.swift */, ); path = Components; sourceTree = ""; @@ -854,7 +854,7 @@ 390451AA2856E1D900E0B563 /* MistApp.swift in Sources */, 39252AA9285C4C9000956C74 /* RefreshRowView.swift in Sources */, 3935F47828643B1F00760AB0 /* UserNotificationCenterDelegate.swift in Sources */, - 390451E72857510C00E0B563 /* TextTag.swift in Sources */, + 390451E72857510C00E0B563 /* TextRibbon.swift in Sources */, 5795700B2A31B06F004C7051 /* ButtonStyle+Extension.swift in Sources */, 390451E1285740E800E0B563 /* Sequence+Extension.swift in Sources */, 398734D4286046B000B4C357 /* UInt32+Extension.swift in Sources */, diff --git a/Mist/Views/Components/TextRibbon.swift b/Mist/Views/Components/TextRibbon.swift new file mode 100644 index 0000000..0851f31 --- /dev/null +++ b/Mist/Views/Components/TextRibbon.swift @@ -0,0 +1,29 @@ +// +// TextRibbon.swift +// Mist +// +// Created by Nindi Gill on 13/6/2022. +// + +import SwiftUI + +struct TextRibbon: View { + var title: String + var length: CGFloat + private let degrees: CGFloat = -45 + + var body: some View { + Text(title) + .foregroundColor(.white) + .frame(width: length) + .background(Color.accentColor) + .rotationEffect(.degrees(degrees)) + .mask(Circle().frame(width: length, height: length)) + } +} + +struct TextRibbon_Previews: PreviewProvider { + static var previews: some View { + TextRibbon(title: "BETA", length: 48) + } +} diff --git a/Mist/Views/Components/TextTag.swift b/Mist/Views/Components/TextTag.swift deleted file mode 100644 index fd13ee4..0000000 --- a/Mist/Views/Components/TextTag.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// TextTag.swift -// Mist -// -// Created by Nindi Gill on 13/6/2022. -// - -import SwiftUI - -struct TextTag: View { - var title: String - private let padding: CGFloat = 5 - private let cornerRadius: CGFloat = 5 - private let color: Color = .accentColor - - var body: some View { - Text(title) - .foregroundColor(.white) - .padding(padding) - .background(color) - .cornerRadius(cornerRadius) - } -} - -struct TextTag_Previews: PreviewProvider { - static var previews: some View { - TextTag(title: "Beta") - } -} diff --git a/Mist/Views/List/ListRow.swift b/Mist/Views/List/ListRow.swift index d455d13..a8bc03e 100644 --- a/Mist/Views/List/ListRow.swift +++ b/Mist/Views/List/ListRow.swift @@ -63,7 +63,12 @@ struct ListRow: View { var body: some View { HStack { - ScaledImage(name: image, length: length) + ZStack { + ScaledImage(name: image, length: length) + if beta { + TextRibbon(title: "BETA", length: length * 0.9) + } + } HStack(spacing: spacing) { Text(version) .font(.title2) @@ -71,9 +76,6 @@ struct ListRow: View { .foregroundColor(.secondary) } .textSelection(.enabled) - if beta { - TextTag(title: "Beta") - } Spacer() Text(date) .foregroundColor(.secondary)