-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the full suite of Tailwind CSS modifiers #51
Labels
enhancement
New feature or request
Milestone
Comments
jverkoey
added
enhancement
New feature or request
good first issue
Good for newcomers
labels
Aug 3, 2024
jverkoey
added a commit
that referenced
this issue
Aug 3, 2024
jverkoey
added a commit
that referenced
this issue
Aug 3, 2024
Can you specify More ? @jverkoey |
I'll be adding an example PR for some of these modifiers shortly :) |
@Avinashshiyani #55 is a PR that adds support for Tailwind CSS' text-align classes. The basic workflow behind adding support for each of the classes in this list is:
extension View {
/// Control the alignment of text.
///
/// - Parameter alignment: Text alignment to be applied to text within the modified view.
public func textAlignment(_ alignment: TextAlignment) -> some View {
return self.modifier(ClassModifier(add: "text-" + alignment.rawValue))
}
}
/// Constants that specify the visual alignment of the text.
public enum TextAlignment: String {
/// Aligns text to the left edge of the text container in
/// left-to-right (LTR) languages, and to the right edge
/// in right-to-left (RTL) languages..
case leading = "start"
/// Aligns text to the center of the text container.
case center
/// Aligns text to the right edge of the text container in
/// left-to-right (LTR) languages, and to the left edge
/// in right-to-left (RTL) languages..
case trailing = "end"
/// Text will fill the container, adding spacing between words as needed.
case justify
}
import Testing
import Slipstream
struct TextAlignmentTests {
@Test func alignments() throws {
try #expect(renderHTML(Div {}.textAlignment(.leading)) == #"<div class="text-start"></div>"#)
try #expect(renderHTML(Div {}.textAlignment(.center)) == #"<div class="text-center"></div>"#)
try #expect(renderHTML(Div {}.textAlignment(.trailing)) == #"<div class="text-end"></div>"#)
try #expect(renderHTML(Div {}.textAlignment(.justify)) == #"<div class="text-justify"></div>"#)
}
} |
Merged
@Avinashshiyani #60 might be an easier issue to take on because it requires fewer moving parts. |
jverkoey
added a commit
that referenced
this issue
Aug 3, 2024
jverkoey
added a commit
that referenced
this issue
Aug 3, 2024
jverkoey
added a commit
that referenced
this issue
Aug 3, 2024
Merged
Merged
Merged
jverkoey
added a commit
that referenced
this issue
Aug 10, 2024
Merged
Merged
Merged
Merged
jverkoey
added a commit
that referenced
this issue
Sep 15, 2024
jverkoey
added a commit
that referenced
this issue
Sep 15, 2024
jverkoey
added a commit
that referenced
this issue
Sep 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Layout
Flexbox & Grid
Spacing
Sizing
Typography
Backgrounds
Borders
Effects
Filters
Tables
Transitions & Animation
Transforms
Interactivity
SVG
The text was updated successfully, but these errors were encountered: