40 lines
1.5 KiB
Swift
40 lines
1.5 KiB
Swift
import Elementary
|
|
|
|
public struct SVG: HTML, Sendable {
|
|
|
|
let key: Key
|
|
|
|
public init(_ key: Key) {
|
|
self.key = key
|
|
}
|
|
|
|
public var body: some HTML {
|
|
HTMLRaw(key.svg)
|
|
}
|
|
}
|
|
|
|
extension SVG {
|
|
public enum Key: Sendable {
|
|
case circlePlus
|
|
case close
|
|
case squarePen
|
|
|
|
var svg: String {
|
|
switch self {
|
|
case .circlePlus:
|
|
return """
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-plus-icon lucide-circle-plus"><circle cx="12" cy="12" r="10"/><path d="M8 12h8"/><path d="M12 8v8"/></svg>
|
|
"""
|
|
case .close:
|
|
return """
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
"""
|
|
case .squarePen:
|
|
return """
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-pen-icon lucide-square-pen"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|