Add `Link` support

This commit is contained in:
Carson Katri 2022-07-06 11:57:28 -04:00
parent 4e8b84e4a1
commit 928827f961
1 changed files with 14 additions and 0 deletions

View File

@ -26,3 +26,17 @@ extension Link: _HTMLPrimitive {
})
}
}
@_spi(TokamakStaticHTML)
extension Link: HTMLConvertible {
public var tag: String { "a" }
public func attributes(useDynamicLayout: Bool) -> [HTMLAttribute: String] {
["href": _LinkProxy(self).destination.absoluteString, "class": "_tokamak-link"]
}
public func primitiveVisitor<V>(useDynamicLayout: Bool) -> ((V) -> ())? where V: ViewVisitor {
{
$0.visit(_LinkProxy(self).label)
}
}
}