-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the initial avatar action menu [...] (#570)
- Loading branch information
Showing
8 changed files
with
125 additions
and
3 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
Sources/GravatarUI/Resources/Media.xcassets/more-horizontal.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "more-horizontal.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ravatarUI/Resources/Media.xcassets/more-horizontal.imageset/more-horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Sources/GravatarUI/SwiftUI/AvatarPicker/AvatarAction.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Foundation | ||
import SwiftUI | ||
|
||
enum AvatarAction: String, CaseIterable, Identifiable { | ||
case share | ||
case delete | ||
|
||
var id: String { rawValue } | ||
|
||
var icon: Image { | ||
switch self { | ||
case .delete: | ||
Image(systemName: "trash") | ||
case .share: | ||
Image(systemName: "square.and.arrow.up") | ||
} | ||
} | ||
|
||
var localizedTitle: String { | ||
switch self { | ||
case .delete: | ||
SDKLocalizedString( | ||
"AvatarPicker.AvatarAction.delete", | ||
value: "Delete", | ||
comment: "An option in the avatar menu that deletes the avatar" | ||
) | ||
case .share: | ||
SDKLocalizedString( | ||
"AvatarPicker.AvatarAction.share", | ||
value: "Share", | ||
comment: "An option in the avatar menu that shares the avatar" | ||
) | ||
} | ||
} | ||
|
||
var role: ButtonRole? { | ||
switch self { | ||
case .delete: | ||
.destructive | ||
case .share: | ||
nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters