Skip to content

Commit

Permalink
Touching up slide over
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt54 committed Sep 29, 2023
1 parent 22cf9ff commit 55fd30e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
2 changes: 0 additions & 2 deletions Sources/SwiftUIPreviewLayouts/PreviewLayouts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public struct PreviewLayouts<Content>: View where Content: View {
HStack(spacing: 0) {
Spacer()
content()
.frame(width: 375)
.slideOverModifier()
}
}
Expand All @@ -101,7 +100,6 @@ public struct PreviewLayouts<Content>: View where Content: View {
HStack(spacing: 0) {
Spacer()
content()
.frame(width: 375)
.slideOverModifier()
}
}
Expand Down
41 changes: 26 additions & 15 deletions Sources/SwiftUIPreviewLayouts/Views/SlideOverModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,35 @@ import SwiftUI

struct SlideOverModifier: ViewModifier {
func body(content: Content) -> some View {
content
VStack(spacing: 0) {
HStack(spacing: 4) {
Circle().frame(width: 4)
Circle().frame(width: 4)
Circle().frame(width: 4)
}
.padding(.bottom, 12)
.foregroundColor(Color.init(white: 0.3))
.frame(height: 28)
.frame(maxWidth: .infinity)
.background(Color.red)
.overlay(
VStack {
HStack(spacing: 4) {
Circle().frame(width: 4)
Circle().frame(width: 4)
Circle().frame(width: 4)
}
Spacer()
RoundedRectangle(cornerRadius: 4)
.frame(width: 100, height: 4)
}
.foregroundColor(Color.init(white: 0.3))
.padding(.vertical, 8)
Text("UNUSABLE HEIGHT ZONE")
)

content
.overlay(
VStack {
Spacer()
RoundedRectangle(cornerRadius: 4)
.frame(width: 100, height: 4)
}
.foregroundColor(Color.init(white: 0.3))
.padding(.vertical, 8)
)
}
.cornerRadius(10)
.padding(.vertical, 24)
.padding(.trailing, 48)
.frame(width: 375)
.padding(.trailing, 24)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import XCTest
import SwiftUI
@testable import SwiftUIPreviewLayouts

#if os(iOS)
final class SwiftUIPreviewLayoutsTests: XCTestCase {
func testGetDeviceString() {
let preview = PreviewLayouts(devices: [.iPad_10, .iPhone_15], content: { TestView() })
Expand All @@ -12,6 +13,7 @@ final class SwiftUIPreviewLayoutsTests: XCTestCase {
XCTAssertEqual(singleDevicePreview.getDeviceString(.iPad_10), "")
}
}
#endif

struct TestView: View {
var body: some View {
Expand Down

0 comments on commit 55fd30e

Please sign in to comment.