Skip to content

Commit 81b7314

Browse files
author
ComputelessComputer
committed
Align chat composer send button
Move the send button into an overlay so it stays centered and no longer changes the composer height.
1 parent 60679a9 commit 81b7314

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

Sources/OpenbirdApp/TodayChatDock.swift

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private struct ChatComposer: View {
255255
}
256256

257257
var body: some View {
258-
ZStack(alignment: .bottomTrailing) {
258+
ZStack(alignment: .leading) {
259259
TextField("", text: $model.chatInput, axis: .vertical)
260260
.textFieldStyle(.plain)
261261
.font(.body)
@@ -269,25 +269,7 @@ private struct ChatComposer: View {
269269
.padding(.leading, 18)
270270
.padding(.trailing, 64)
271271
.padding(.vertical, 16)
272-
.background(
273-
RoundedRectangle(cornerRadius: 24, style: .continuous)
274-
.fill(.regularMaterial)
275-
.shadow(color: Color.black.opacity(0.14), radius: 24, y: 14)
276-
.shadow(color: Color.black.opacity(0.06), radius: 8, y: 3)
277-
)
278-
.overlay(
279-
RoundedRectangle(cornerRadius: 24, style: .continuous)
280-
.strokeBorder(
281-
LinearGradient(
282-
colors: [
283-
Color.white.opacity(0.62),
284-
Color.white.opacity(0.18)
285-
],
286-
startPoint: .topLeading,
287-
endPoint: .bottomTrailing
288-
)
289-
)
290-
)
272+
.frame(maxWidth: .infinity, alignment: .leading)
291273

292274
if model.chatInput.isEmpty {
293275
HStack {
@@ -300,7 +282,28 @@ private struct ChatComposer: View {
300282
.padding(.vertical, 16)
301283
.allowsHitTesting(false)
302284
}
303-
285+
}
286+
.frame(maxWidth: .infinity)
287+
.background(
288+
RoundedRectangle(cornerRadius: 24, style: .continuous)
289+
.fill(.regularMaterial)
290+
.shadow(color: Color.black.opacity(0.14), radius: 24, y: 14)
291+
.shadow(color: Color.black.opacity(0.06), radius: 8, y: 3)
292+
)
293+
.overlay(
294+
RoundedRectangle(cornerRadius: 24, style: .continuous)
295+
.strokeBorder(
296+
LinearGradient(
297+
colors: [
298+
Color.white.opacity(0.62),
299+
Color.white.opacity(0.18)
300+
],
301+
startPoint: .topLeading,
302+
endPoint: .bottomTrailing
303+
)
304+
)
305+
)
306+
.overlay(alignment: .trailing) {
304307
Button(action: send) {
305308
Group {
306309
if model.isSendingChat {
@@ -318,7 +321,7 @@ private struct ChatComposer: View {
318321
.controlSize(.regular)
319322
.clipShape(Circle())
320323
.disabled(canSend == false)
321-
.padding(10)
324+
.padding(.trailing, 10)
322325
}
323326
.onChange(of: focusedField.wrappedValue) { _, newValue in
324327
if newValue == .composer {

0 commit comments

Comments
 (0)