-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of #51.
- Loading branch information
Showing
32 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
Sources/Slipstream/Documentation.docc/TailwindCSS/Layout/Layout-Float.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Floats | ||
|
||
Utilities for controlling the wrapping of content around a view. | ||
|
||
## Topics | ||
|
||
### Modifiers | ||
|
||
- ``View/float(_:condition:)`` | ||
|
||
### Supporting types | ||
|
||
- ``FloatMode`` |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// Constants that control the wrapping of content around a view. | ||
/// | ||
/// - SeeAlso: Tailwind CSS' [floats](https://tailwindcss.com/docs/float) documentation. | ||
@available(iOS 17.0, macOS 14.0, *) | ||
public enum FloatMode: String { | ||
case start | ||
case end | ||
case right | ||
case left | ||
case none | ||
} | ||
|
||
extension View { | ||
/// Change how content wraps around the modified view. | ||
/// | ||
/// - SeeAlso: Tailwind CSS' [floats](https://tailwindcss.com/docs/float) documentation. | ||
@available(iOS 17.0, macOS 14.0, *) | ||
public func float(_ floatMode: FloatMode, condition: Condition? = nil) -> some View { | ||
return modifier(TailwindClassModifier(add: "float-" + floatMode.rawValue, condition: condition)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Testing | ||
import Slipstream | ||
|
||
struct FloatTests { | ||
@Test func enumeration() throws { | ||
try #expect(renderHTML(Div {}.float(.start)) == #"<div class="float-start"></div>"#) | ||
try #expect(renderHTML(Div {}.float(.end)) == #"<div class="float-end"></div>"#) | ||
try #expect(renderHTML(Div {}.float(.left)) == #"<div class="float-left"></div>"#) | ||
try #expect(renderHTML(Div {}.float(.right)) == #"<div class="float-right"></div>"#) | ||
try #expect(renderHTML(Div {}.float(.none)) == #"<div class="float-none"></div>"#) | ||
} | ||
} |