Skip to content

Commit

Permalink
Fix accented Widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
rrroyal committed Oct 19, 2024
1 parent 57ffb0c commit fb76ac3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 7 additions & 2 deletions HarbourWidgets/UI/View Modifiers/InsetViewModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ import SwiftUI
// MARK: - InsetViewModifier

struct InsetViewModifier: ViewModifier {
@Environment(\.widgetRenderingMode) private var widgetRenderingMode

private var shouldUseTransparentBackground: Bool {
widgetRenderingMode == .accented
}

func body(content: Content) -> some View {
content
.clipShape(ContainerRelativeShape())
.background(
ContainerRelativeShape()
.fill(Color.widgetBackground)
.fill(Color.widgetBackground.opacity(shouldUseTransparentBackground ? 0.04 : 1))
.shadow(color: .black.opacity(0.04), radius: 6, x: 0, y: 0)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ extension ContainerStatusWidget {
#endif
.foregroundStyle(.tint)
.minimumScaleFactor(minimumScaleFactor)
.widgetAccentable()
}

@ViewBuilder @MainActor
private var stateIcon: some View {
Circle()
.fill(redactionReasons.isEmpty ? AnyShapeStyle(.tint) : AnyShapeStyle(.tint.secondary))
.frame(width: circleSize, height: circleSize)
.widgetAccentable()
}

@ViewBuilder @MainActor
Expand Down Expand Up @@ -126,9 +128,7 @@ extension ContainerStatusWidget {
VStack(spacing: 0) {
HStack {
stateHeadline

Spacer()

stateIcon
}

Expand All @@ -149,7 +149,6 @@ extension ContainerStatusWidget {
.tint(container?.state.color ?? Container.State?.none.color)
.contentTransition(.opacity)
.modifier(LinkWrappedViewModifier(url: url))
.background(Color.widgetBackground)
.id("ContainerStatusWidgetView.ContainerView:\(container?.id ?? intentContainer._id)")
}
}
Expand Down

0 comments on commit fb76ac3

Please sign in to comment.