Skip to content

Commit

Permalink
Merge pull request #193 from JPToroDev/main
Browse files Browse the repository at this point in the history
  • Loading branch information
twostraws authored Dec 24, 2024
2 parents a994041 + b1c5d19 commit bc6531d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/Ignite/Framework/ForEach.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

/// A structure that creates HTML content by mapping over a sequence of data.
public struct ForEach<Data: Sequence, Content: HTML>: InlineHTML, BlockHTML {
public struct ForEach<Data: Sequence, Content: HTML>: InlineHTML, BlockHTML, ListableElement {
/// The body content created by mapping over the data sequence.
public var body: some HTML { self }

Expand Down Expand Up @@ -46,4 +46,12 @@ public struct ForEach<Data: Sequence, Content: HTML>: InlineHTML, BlockHTML {

return output
}

/// Renders the ForEach content when this isn't part of a list.
/// - Parameter context: The current publishing context.
/// - Returns: The rendered HTML string.
func renderInList(context: PublishingContext) -> String {
// ListableElement conformance ensures other views never wrap ForEach in <li> tags.
render(context: context)
}
}
9 changes: 9 additions & 0 deletions Sources/Ignite/Modifiers/FontWeightModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ public extension HTML {
modifier(FontWeightModifier(weight: newWeight))
}
}

public extension InlineHTML {
/// Adjusts the font weight (boldness) of this font.
/// - Parameter newWeight: The new font weight.
/// - Returns: A new `Text` instance with the updated weight.
func fontWeight(_ newWeight: Font.Weight) -> some InlineHTML {
modifier(FontWeightModifier(weight: newWeight))
}
}

0 comments on commit bc6531d

Please sign in to comment.