Skip to content

Commit 6e7c5cb

Browse files
committed
Media Query -> Screen renamed
1 parent c956cfa commit 6e7c5cb

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Sources/SwiftCss/Rules/Media.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public struct Media: Rule {
99

10-
public enum Query: String {
10+
public enum Screen: String {
1111
/// 0-599px
1212
case xs = "screen and (max-width: 599px)"
1313
/// 600-899px
@@ -20,7 +20,7 @@ public struct Media: Rule {
2020
case xl = "screen and (min-width: 1800px)"
2121
/// dark mode
2222
case dark = "screen and (prefers-color-scheme: dark)"
23-
/// standalone app
23+
/// standalone app screen
2424
case standalone = "screen and (display-mode: standalone)"
2525
}
2626

@@ -32,8 +32,8 @@ public struct Media: Rule {
3232
self.selectors = builder()
3333
}
3434

35-
public init(_ query: Query, @SelectorBuilder _ builder: () -> [Selector]) {
36-
self.init(query.rawValue, builder)
35+
public init(screen: Screen, @SelectorBuilder _ builder: () -> [Selector]) {
36+
self.init(screen.rawValue, builder)
3737
}
3838

3939
public var css: String {

Tests/SwiftCssTests/SwiftCssTests.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ final class SwiftCssTests: XCTestCase {
116116
Width("var(--size)")
117117
}
118118
}
119-
Media(.xs) {
119+
Media(screen: .xs) {
120120
Root {
121121
Variable("size", "200px")
122122
}
123123
}
124-
Media(.dark) {
124+
Media(screen: .dark) {
125125
Root {
126126
Variable("size", "500px")
127127
}
128128
}
129-
Media(.standalone) {
129+
Media(screen: .standalone) {
130130
Root {
131131
Variable("size", "460px")
132132
}
@@ -145,17 +145,17 @@ final class SwiftCssTests: XCTestCase {
145145
Background(.color(.red))
146146
}
147147
}
148-
Media(.xs) {
148+
Media(screen: .xs) {
149149
Root {
150150
Background(.color(.blue))
151151
}
152152
}
153-
Media(.dark) {
153+
Media(screen: .dark) {
154154
Root {
155155
Background(.color(.green))
156156
}
157157
}
158-
Media(.standalone) {
158+
Media(screen: .standalone) {
159159
Body {
160160
Background(.color(.yellow))
161161
}

0 commit comments

Comments
 (0)