adds nice git interface
This commit is contained in:
@@ -50,15 +50,17 @@ public struct ContextMenuRow: View {
|
||||
var shortcut: String?
|
||||
var isHighlighted: Bool
|
||||
var isDestructive: Bool
|
||||
var isEmphasized: Bool
|
||||
|
||||
public init(_ label: String, systemImage: String? = nil, iconTint: Color? = nil, shortcut: String? = nil,
|
||||
isHighlighted: Bool, isDestructive: Bool = false) {
|
||||
isHighlighted: Bool, isDestructive: Bool = false, isEmphasized: Bool = false) {
|
||||
self.label = label
|
||||
self.systemImage = systemImage
|
||||
self.iconTint = iconTint
|
||||
self.shortcut = shortcut
|
||||
self.isHighlighted = isHighlighted
|
||||
self.isDestructive = isDestructive
|
||||
self.isEmphasized = isEmphasized
|
||||
}
|
||||
|
||||
/// Pass as `systemImage` for the pass-on spark, which has no SF Symbol.
|
||||
@@ -77,7 +79,7 @@ public struct ContextMenuRow: View {
|
||||
.foregroundStyle(iconColor)
|
||||
.frame(width: 15)
|
||||
}
|
||||
Text(label).typeRole(isHighlighted ? Typography.menuItemHighlighted : Typography.menuItem)
|
||||
Text(label).typeRole(labelRole)
|
||||
.foregroundStyle(labelColor)
|
||||
Spacer(minLength: 8)
|
||||
if let shortcut {
|
||||
@@ -95,6 +97,11 @@ public struct ContextMenuRow: View {
|
||||
.pointerHand()
|
||||
}
|
||||
|
||||
private var labelRole: TypeRole {
|
||||
if isEmphasized { return Typography.menuItemEmphasized }
|
||||
return isHighlighted ? Typography.menuItemHighlighted : Typography.menuItem
|
||||
}
|
||||
|
||||
private var labelColor: Color {
|
||||
if isDestructive { return Palette.removedText }
|
||||
return isHighlighted ? Palette.text1 : Palette.text3
|
||||
|
||||
Reference in New Issue
Block a user