defmodule PortfolioWeb.CustomComponents do
use Phoenix.Component
import PortfolioWeb.CoreComponents
@doc """
Renders an anchor tag that opens a new tab.
## Examples
<.link_blank href="/files/tagless-final-parsing/kiselyov-interpreters.pdf">
PDF
,
"""
attr :href, :string, required: true
slot :inner_block, required: true
def link_blank(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a project description.
"""
attr :title, :string, required: true
attr :href, :string, required: true
attr :date, :string, required: true
slot :inner_block, required: true
def project(assigns) do
~H"""
"""
end
@doc """
Renders a blog description.
"""
attr :title, :string, required: true
attr :href, :string, required: true
attr :date, :string, required: true
slot :inner_block, required: true
def blog(assigns) do
~H"""
<.link navigate={@href} class="pr-1 font-bold text-cyan-500"><%= @title %>
<%= @date %>
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders an informational admonition.
"""
slot :inner_block, required: true
def info(assigns) do
~H"""
<.icon name="hero-information-circle" />
Info
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a tip admonition.
"""
slot :inner_block, required: true
def tip(assigns) do
~H"""
<.icon name="hero-pencil" />
Tip
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a warning admonition.
"""
slot :inner_block, required: true
def warning(assigns) do
~H"""
<.icon name="hero-exclamation-triangle" />
Warning
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders an accordion.
"""
attr :header, :string, required: true
slot :inner_block, required: true
def accordion(assigns) do
~H"""
<%= @header %>
<%= render_slot(@inner_block) %>
"""
end
end