Skip to content

Commit

Permalink
Media Query -> Screen renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
tib committed Jul 24, 2021
1 parent c956cfa commit 6e7c5cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Sources/SwiftCss/Rules/Media.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public struct Media: Rule {

public enum Query: String {
public enum Screen: String {
/// 0-599px
case xs = "screen and (max-width: 599px)"
/// 600-899px
Expand All @@ -20,7 +20,7 @@ public struct Media: Rule {
case xl = "screen and (min-width: 1800px)"
/// dark mode
case dark = "screen and (prefers-color-scheme: dark)"
/// standalone app
/// standalone app screen
case standalone = "screen and (display-mode: standalone)"
}

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

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

public var css: String {
Expand Down
12 changes: 6 additions & 6 deletions Tests/SwiftCssTests/SwiftCssTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ final class SwiftCssTests: XCTestCase {
Width("var(--size)")
}
}
Media(.xs) {
Media(screen: .xs) {
Root {
Variable("size", "200px")
}
}
Media(.dark) {
Media(screen: .dark) {
Root {
Variable("size", "500px")
}
}
Media(.standalone) {
Media(screen: .standalone) {
Root {
Variable("size", "460px")
}
Expand All @@ -145,17 +145,17 @@ final class SwiftCssTests: XCTestCase {
Background(.color(.red))
}
}
Media(.xs) {
Media(screen: .xs) {
Root {
Background(.color(.blue))
}
}
Media(.dark) {
Media(screen: .dark) {
Root {
Background(.color(.green))
}
}
Media(.standalone) {
Media(screen: .standalone) {
Body {
Background(.color(.yellow))
}
Expand Down

0 comments on commit 6e7c5cb

Please sign in to comment.