defmodule ChiyaWeb.PublicComponents do
use Phoenix.Component
use Phoenix.VerifiedRoutes,
endpoint: ChiyaWeb.Endpoint,
router: ChiyaWeb.Router,
statics: ChiyaWeb.static_paths()
import ChiyaWeb.Format
import ChiyaWeb.Markdown, only: [render: 1]
import Phoenix.HTML, only: [raw: 1]
import ChiyaWeb.DarkModeToggle
@doc """
Renders a [Hero Icon](https://heroicons.com).
Hero icons come in three styles – outline, solid, and mini.
By default, the outline style is used, but solid an mini may
be applied by using the `-solid` and `-mini` suffix.
You can customize the size and colors of the icons by setting
width, height, and background color classes.
Icons are extracted from your `priv/hero_icons` directory and bundled
within your compiled app.css by the plugin in your `assets/tailwind.config.js`.
## Examples
<.icon name="hero-cake" />
<.icon name="hero-cake-solid" />
<.icon name="hero-cake-mini" />
<.icon name="hero-bolt" class="bg-blue-500 w-10 h-10" />
"""
attr :name, :string, required: true
attr :class, :string, default: nil
def icon(%{name: "hero-" <> _} = assigns) do
~H"""
"""
end
@doc """
Renders a middot as divider
"""
attr :class, :string, default: "text-theme-primary"
def dot(assigns),
do: ~H"""
·
"""
@doc """
Renders a horizontal line
"""
def line(assigns),
do: ~H"""
"""
attr :note, :map, required: true
attr :class_tag, :string, default: ""
attr :linked, :boolean, default: true
def tags(assigns) do
~H"""
<%= for tag <- @note.tags do %>
<%= if assigns.linked do %>
<%= tag.name %>
<% else %>
<%= tag.name %>
<% end %>
<.dot class="text-theme-base/50 last:hidden" />
<% end %>
"""
end
@doc """
Renders a note-header with title.
"""
attr :class, :string, default: nil
attr :class_title, :string, default: nil
attr :class_subtitle, :string, default: nil
slot :subtitle, required: false
def header(assigns) do
~H"""