the alias goes in the view module (#107)

This commit is contained in:
Michel Belleville 2021-01-21 00:03:41 +01:00 committed by GitHub
parent 8377a04ab3
commit 6fe46cbb49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -88,8 +88,10 @@ end
And we could use the component like so
```elixir
# lib/my_app_web/views/page_view.ex
alias MyAppWeb.Components.Flex
# lib/my_app_web/templates/page/index.html.exs
c Flex, class: "justify-between items-center", id: "arnold" do
div do: "Hi"
div do: "I'm"

View file

@ -44,8 +44,10 @@ defmodule Temple.Component do
Since components are just modules, if you alias your module, you can use them more ergonomically.
```
# lib/my_app_web/views/page_view.ex
alias MyAppWeb.Components.Flex
# lib/my_app_web/templates/page/index.html.exs
c Flex, class: "justify-between items center" do
for item <- items do
div class: "p-4" do