-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed default sidebar avatars (#689)
- Loading branch information
Showing
8 changed files
with
128 additions
and
92 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,33 @@ | ||
// | ||
// AvatarType.swift | ||
// Mlem | ||
// | ||
// Created by Eric Andrews on 2023-10-02. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Enum of things that can have avatars | ||
enum AvatarType { | ||
case user, community | ||
} | ||
|
||
extension AvatarType: AssociatedIcon { | ||
var iconName: String { | ||
switch self { | ||
case .user: | ||
return Icons.user | ||
case .community: | ||
return Icons.community | ||
} | ||
} | ||
|
||
var iconNameFill: String { | ||
switch self { | ||
case .user: | ||
return Icons.userFill | ||
case .community: | ||
return Icons.communityFill | ||
} | ||
} | ||
} |
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,21 @@ | ||
// | ||
// DefaultAvatarView.swift | ||
// Mlem | ||
// | ||
// Created by Eric Andrews on 2023-10-02. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct DefaultAvatarView: View { | ||
let avatarType: AvatarType | ||
|
||
var body: some View { | ||
Image(systemName: avatarType.iconNameFill) | ||
.resizable() | ||
.scaledToFill() | ||
.background(.white) | ||
.foregroundStyle(Color.gray.gradient) | ||
} | ||
} |
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
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