Skip to content

Commit

Permalink
Add Divider view.
Browse files Browse the repository at this point in the history
Part of #25.
  • Loading branch information
jverkoey committed Aug 6, 2024
1 parent 5379ab4 commit efccdbd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Sources/Slipstream/Documentation.docc/W3C/W3CViews.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ The complete W3C HTML elements standard can be found [here](https://html.spec.wh

### Grouping content

- ``Div``
- ``Paragraph``
- ``Divider``
- ``Div``

### Text-level semantics

Expand Down
32 changes: 32 additions & 0 deletions Sources/Slipstream/W3C/Elements/GroupingContent/Divider.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import SwiftSoup

/// A divider represents a paragraph-level thematic break, e.g., a
/// scene change in a story, or a transition to another topic within
/// a section of a reference book.
///
/// ```swift
/// struct MySiteContent: View {
/// var body: some View {
/// Body {
/// Div {
/// Paragraph("Hello, world!")
/// Divider()
/// Paragraph("Let's make a website!")
/// }
/// }
/// }
/// }
/// ```
///
/// - SeeAlso: W3C [`hr`](https://html.spec.whatwg.org/multipage/grouping-content.html#the-hr-element) specification.
@available(iOS 17.0, macOS 14.0, *)
public struct Divider: View {
/// Creates a divider view.
public init() {
}

@_documentation(visibility: private)
public func render(_ container: Element, environment: EnvironmentValues) throws {
_ = try container.appendElement("hr")
}
}
1 change: 0 additions & 1 deletion Sources/Slipstream/W3C/Elements/Scripting/Script.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public struct Script: View {

@_documentation(visibility: private)
public func render(_ container: Element, environment: EnvironmentValues) throws {

switch storage {
case .url(let url, let executionMode):
guard let url else {
Expand Down

0 comments on commit efccdbd

Please sign in to comment.