-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from jaesung-0o0/feature/jaesung/message-menu
[Release/1.0.0-beta.2] Message Menu
- Loading branch information
Showing
14 changed files
with
584 additions
and
43 deletions.
There are no files selected for viewing
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
48 changes: 48 additions & 0 deletions
48
Sources/ChatUI/ChatInChannel/MessageMenu/MessageMenu.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,48 @@ | ||
// | ||
// MessageMenu.swift | ||
// | ||
// | ||
// Created by Jaesung Lee on 2023/03/06. | ||
// | ||
|
||
import SwiftUI | ||
|
||
/// The menu for the message | ||
public struct MessageMenu<Content: View>: View { | ||
@Environment(\.appearance) var appearance | ||
@ViewBuilder let content: () -> Content | ||
|
||
public var body: some View { | ||
VStack(spacing: 0) { | ||
content() | ||
} | ||
.frame(width: 240) | ||
.background(appearance.remoteMessageBackground) | ||
.cornerRadius(14) | ||
} | ||
|
||
public init(@ViewBuilder content: @escaping () -> Content) { | ||
self.content = content | ||
} | ||
} | ||
|
||
public struct MessageMenuButtonStyle: ButtonStyle { | ||
@Environment(\.appearance) var appearance | ||
let symbol: String | ||
|
||
public func makeBody(configuration: Configuration) -> some View { | ||
HStack { | ||
configuration.label | ||
Spacer() | ||
Image(systemName: symbol) | ||
} | ||
.padding(.horizontal, 16) | ||
.foregroundColor(appearance.primary) | ||
.background(configuration.isPressed ? appearance.secondaryBackground : Color.clear) | ||
.frame(height: 44) | ||
} | ||
|
||
public init(symbol: String) { | ||
self.symbol = symbol | ||
} | ||
} |
Oops, something went wrong.