Skip to content

Commit

Permalink
example fixes + pico
Browse files Browse the repository at this point in the history
  • Loading branch information
sliemeobn committed Jun 26, 2024
1 parent 87913a8 commit 0504916
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Examples/HummingbirdDemo/Sources/App/Public/pico.min.css

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions Examples/HummingbirdDemo/Sources/App/Views.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ struct MainPage: HTMLDocument {
var head: some HTML {
meta(.charset(.utf8))
script(.src("/htmx.min.js")) {}
link(.href("/pico.min.css"), .rel(.stylesheet))
}

var body: some HTML {
h1 { "Hummingbird + Elementary + HTMX Demo" }
main {
header(.class("container")) {
h2 { "Hummingbird + Elementary + HTMX Demo" }
}
main(.class("container")) {
div {
// example of using hx-target and hx-swap
form(.hx.post("/items"), .hx.target("#list"), .hx.swap(.outerHTML)) {
input(.type(.text), .name("item"), .value("New Item"))
input(.type(.submit), .value("Add Item"))
div(.class("grid")) {
input(.type(.text), .name("item"), .value("New Item"), .required)
input(.type(.submit), .value("Add Item"))
}
}
}
ItemList(items: model.items)
Expand All @@ -37,7 +42,7 @@ struct ItemList: HTML {
for (index, item) in items.enumerated() {
div {
// this hx-delete will use OOB swap
button(.hx.delete("items/\(index)")) { "" }
button(.hx.delete("items/\(index)")) { "X" }
" "
item
}
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/sliemeobn/elementary.git", .upToNextMajor(from: "0.1.0-beta.5")),
.package(url: "https://github.com/sliemeobn/elementary.git", .upToNextMajor(from: "0.1.0-beta.7")),
],
targets: [
.target(
Expand Down

0 comments on commit 0504916

Please sign in to comment.