-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7300c2
commit 0a7874a
Showing
4 changed files
with
44 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,33 @@ | ||
# FrancisHtmx | ||
|
||
WIP | ||
Module to use HTMX with Francis | ||
|
||
```elixir | ||
defmodule Example do | ||
use Francis | ||
import FrancisHtmx | ||
|
||
htmx(fn _conn -> | ||
assigns = %{} | ||
~E""" | ||
<style> | ||
.smooth { transition: all 1s ease-in; font-size: 8rem; } | ||
</style> | ||
<div hx-get="/colors" hx-trigger="every 1s"> | ||
<p id="color-demo" class="smooth">Color Swap Demo</p> | ||
</div> | ||
""" | ||
end) | ||
|
||
get("/colors", fn _ -> | ||
new_color = 3 |> :crypto.strong_rand_bytes() |> Base.encode16() |> then(&"##{&1}") | ||
assigns = %{new_color: new_color} | ||
|
||
~E""" | ||
<p id="color-demo" class="smooth" style="<%= "color:#{@new_color}"%>"> | ||
Color Swap Demo | ||
</p> | ||
""" | ||
end) | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters