devel #36
4 changed files with 51 additions and 4 deletions
|
@ -57,6 +57,9 @@ defmodule ChiyaWeb do
|
|||
use Phoenix.LiveView,
|
||||
layout: {ChiyaWeb.Layouts, :app}
|
||||
|
||||
# Import admin components
|
||||
import ChiyaWeb.AdminComponents
|
||||
|
||||
unquote(html_helpers())
|
||||
end
|
||||
end
|
||||
|
@ -79,6 +82,25 @@ defmodule ChiyaWeb do
|
|||
|
||||
# Include general helpers for rendering HTML
|
||||
unquote(html_helpers())
|
||||
|
||||
# Import admin components
|
||||
import ChiyaWeb.AdminComponents
|
||||
end
|
||||
end
|
||||
|
||||
def html_public do
|
||||
quote do
|
||||
use Phoenix.Component
|
||||
|
||||
# Import convenience functions from controllers
|
||||
import Phoenix.Controller,
|
||||
only: [get_csrf_token: 0, view_module: 1, view_template: 1]
|
||||
|
||||
# Include general helpers for rendering HTML
|
||||
unquote(html_helpers())
|
||||
|
||||
# Import public components
|
||||
import ChiyaWeb.PublicComponents
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -94,7 +116,6 @@ defmodule ChiyaWeb do
|
|||
alias Phoenix.LiveView.JS
|
||||
|
||||
# Custom functions
|
||||
import ChiyaWeb.AdminComponents
|
||||
import ChiyaWeb.Format, only: [from_now: 1, pretty_date: 1]
|
||||
alias ChiyaWeb.Markdown
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
defmodule ChiyaWeb.AdminComponents do
|
||||
|
||||
use Phoenix.Component
|
||||
|
||||
use Phoenix.VerifiedRoutes,
|
||||
endpoint: ChiyaWeb.Endpoint,
|
||||
router: ChiyaWeb.Router,
|
||||
|
@ -8,6 +8,15 @@ defmodule ChiyaWeb.AdminComponents do
|
|||
|
||||
import ChiyaWeb.CoreComponents
|
||||
|
||||
@doc """
|
||||
Renders a horizontal line
|
||||
"""
|
||||
def line(assigns) do
|
||||
~H"""
|
||||
<hr class="my-6 dark:border-gray-700" />
|
||||
"""
|
||||
end
|
||||
|
||||
@doc """
|
||||
Renders a UI for uploading files
|
||||
"""
|
||||
|
|
17
lib/chiya_web/components/public_components.ex
Normal file
17
lib/chiya_web/components/public_components.ex
Normal file
|
@ -0,0 +1,17 @@
|
|||
defmodule ChiyaWeb.PublicComponents do
|
||||
use Phoenix.Component
|
||||
|
||||
use Phoenix.VerifiedRoutes,
|
||||
endpoint: ChiyaWeb.Endpoint,
|
||||
router: ChiyaWeb.Router,
|
||||
statics: ChiyaWeb.static_paths()
|
||||
|
||||
@doc """
|
||||
Renders a horizontal line
|
||||
"""
|
||||
def line(assigns) do
|
||||
~H"""
|
||||
<hr class="my-6 border-theme-dim" />
|
||||
"""
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
defmodule ChiyaWeb.PageHTML do
|
||||
use ChiyaWeb, :html
|
||||
use ChiyaWeb, :html_public
|
||||
|
||||
embed_templates "page_html/*"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue