Current section
Files
Jump to
Current section
Files
lib/usher/web/components/layouts.ex
defmodule Usher.Web.Layouts do
@moduledoc false
use Usher.Web, :html
phoenix_js_paths =
for app <- ~w(phoenix phoenix_html phoenix_live_view)a do
path = Application.app_dir(app, ["priv", "static", "#{app}.js"])
Module.put_attribute(__MODULE__, :external_resource, path)
path
end
@static_path Application.app_dir(:usher_web, ["priv", "static"])
@external_resource css_path = Path.join(@static_path, "app.css")
@external_resource js_path = Path.join(@static_path, "app.js")
@css File.read!(css_path)
@js """
#{for path <- phoenix_js_paths, do: path |> File.read!() |> String.replace("//# sourceMappingURL=", "// ")}
#{File.read!(js_path)}
"""
def render("app.css"), do: @css
def render("app.js"), do: @js
embed_templates "layouts/*"
def logo(assigns) do
~H"""
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 64 64">
<g id="Waiter">
<path
d="M11,24V15A12.01375,12.01375,0,0,1,23,3a11.82692,11.82692,0,0,1,9.78809,5.07861l.47119.669.74853-.3291A4.92486,4.92486,0,0,1,36,8a5.00588,5.00588,0,0,1,5,5V24Z"
style="fill:#454f5e"
/>
<path
d="M1,61V49.57813a8.03107,8.03107,0,0,1,5.23486-7.50684L20,37H32l13.76563,5.07129A8.03132,8.03132,0,0,1,51,49.57813V61Z"
style="fill:#8abcf9"
/>
<path d="M13,29a4,4,0,0,1,0-8h2v8Z" style="fill:#f2c0bb" />
<path d="M37,29V21h2a4,4,0,0,1,0,8Z" style="fill:#f2c0bb" />
<path
d="M45.76563,42.07129,32,37H26V61H51V49.57813A8.03132,8.03132,0,0,0,45.76563,42.07129Z"
style="fill:#6fa0ef"
/>
<path
d="M26,44a6.00657,6.00657,0,0,1-6-6V37H32v1A6.00657,6.00657,0,0,1,26,44Z"
style="fill:#f2c0bb"
/>
<path
d="M33.001,50.38379a.98923.98923,0,0,1-.44727-.10742L28,48V44l4.55273-2.27637a.99369.99369,0,0,1,.97461.04492A.98012.98012,0,0,1,34,42.61816v6.76368a.98107.98107,0,0,1-.47412.85058A1.00391,1.00391,0,0,1,33.001,50.38379Z"
style="fill:#ff5876"
/>
<path
d="M18.999,50.38379a1.002,1.002,0,0,1-.52588-.15234A.97952.97952,0,0,1,18,49.38184V42.61816a.98107.98107,0,0,1,.47412-.85058,1.00637,1.00637,0,0,1,.52637-.15137.9892.9892,0,0,1,.44482.10645L24,44v4l-4.55273,2.27637A.99629.99629,0,0,1,18.999,50.38379Z"
style="fill:#ff5876"
/>
<rect x="24" y="44" width="4" height="5" style="fill:#ef1d5e" />
<path
d="M13,39.57893h0L8,41.421V61H26V56.9195a3,3,0,0,0-1.74283-2.72388L21.554,52.948A14.72429,14.72429,0,0,1,13,39.57893Z"
style="fill:#5a6572"
/>
<path
d="M39,39.57893h0l5,1.8421V61H26V56.9195a3,3,0,0,1,1.74283-2.72388L30.44605,52.948A14.72429,14.72429,0,0,0,39,39.57893Z"
style="fill:#454f5e"
/>
<path
d="M34.66864,17a2.33163,2.33163,0,0,0-1.23566.35437,14.02445,14.02445,0,0,1-14.866,0A2.33139,2.33139,0,0,0,15,19.33136V28a11,11,0,0,0,22,0V19.33136A2.33133,2.33133,0,0,0,34.66864,17Z"
style="fill:#f9dbd2"
/>
<circle cx="51" cy="44" r="4" style="fill:#a9c5ed" />
<path
d="M51,44A11.01245,11.01245,0,0,0,40,55v2a.99974.99974,0,0,0,1,1H61a.99974.99974,0,0,0,1-1V55A11.01245,11.01245,0,0,0,51,44Z"
style="fill:#c3dbfc"
/>
<rect x="38" y="56" width="26" height="6" rx="1" ry="1" style="fill:#a9c5ed" />
<path
d="M20.707,26.707a1.83071,1.83071,0,0,1,2.58594,0A.99989.99989,0,0,0,24.707,25.293a3.83173,3.83173,0,0,0-5.41406,0A.99989.99989,0,0,0,20.707,26.707Z"
style="fill:#2a2b35"
/>
<path
d="M28.707,26.707a1.83071,1.83071,0,0,1,2.58594,0A.99989.99989,0,0,0,32.707,25.293a3.83173,3.83173,0,0,0-5.41406,0A.99989.99989,0,0,0,28.707,26.707Z"
style="fill:#2a2b35"
/>
<path
d="M22.168,31.44531a1.00017,1.00017,0,0,0,.27734,1.38672,6.39435,6.39435,0,0,0,7.10938,0A1,1,0,1,0,28.44531,31.168a4.397,4.397,0,0,1-4.89062,0A.99843.99843,0,0,0,22.168,31.44531Z"
style="fill:#2a2b35"
/>
<path
d="M63,56H62V55a11.00859,11.00859,0,0,0-7.07568-10.26373,4.00019,4.00019,0,1,0-7.84864,0A11.00859,11.00859,0,0,0,40,55v1H39a.99974.99974,0,0,0-1,1v4a.99974.99974,0,0,0,1,1H63a.99974.99974,0,0,0,1-1V57A.99974.99974,0,0,0,63,56ZM49,44a2,2,0,0,1,4,0c0,.06317-.01642.12482-.0224.18768a10.51291,10.51291,0,0,0-3.9552,0C49.01642,44.12482,49,44.06317,49,44ZM42,55a9,9,0,0,1,18,0v1H42Zm20,5H40V58H62Z"
style="fill:#2a2b35"
/>
<path
d="M35,60H27V56.91992a2.00152,2.00152,0,0,1,1.15918-1.81152l2.71094-1.251A15.78906,15.78906,0,0,0,39.936,40.99023l2.98754,1.09913.74146.27294.45019.16016a1.00014,1.00014,0,1,0,.66993-1.88476L34.19293,36.74353A11.97072,11.97072,0,0,0,37.81934,30H39a4.983,4.983,0,0,0,3-8.97443V13a6.00657,6.00657,0,0,0-6-6,5.94132,5.94132,0,0,0-2.396.50342A12.98894,12.98894,0,0,0,10,15v6.02557A4.983,4.983,0,0,0,13,30h1.18066a11.97041,11.97041,0,0,0,3.627,6.744L5.8833,41.13184A9.041,9.041,0,0,0,0,49.58008V61a.99974.99974,0,0,0,1,1H35a1,1,0,0,0,0-2ZM19.02167,38.42834a6.9527,6.9527,0,0,0,.52368,2.27826A1.98356,1.98356,0,0,0,17,42.61816v5.50049a13.74335,13.74335,0,0,1-2.97485-7.8515ZM33,49.38184l-4-2V44.61816l4-2Zm-14,0V42.61816l4,2v2.76368Zm6-4.46174a6.29777,6.29777,0,0,0,2,0V48H25ZM26,43a5.00393,5.00393,0,0,1-4.90491-4.05951,11.88318,11.88318,0,0,0,9.80982,0A5.00393,5.00393,0,0,1,26,43ZM12.064,40.98926a15.77992,15.77992,0,0,0,9.07081,12.86719l2.70361,1.24707A2.00514,2.00514,0,0,1,25,56.91992V60H9V42.11816ZM30.03125,52.042l-2.71094,1.251a3.97856,3.97856,0,0,0-1.3186.98913,3.98128,3.98128,0,0,0-1.32544-.995L21.97266,52.04a13.60524,13.60524,0,0,1-1.80219-1.00714l3.00366-1.50183A.98322.98322,0,0,0,24,50h4a.98332.98332,0,0,0,.82593-.46893l3.006,1.5028A13.62459,13.62459,0,0,1,30.03125,52.042ZM35,48.11926v-5.5011a1.98216,1.98216,0,0,0-2.54578-1.91034,6.952,6.952,0,0,0,.52405-2.27923l4.99658,1.83923A13.74805,13.74805,0,0,1,35,48.11926ZM39,28H38V22h1a3,3,0,0,1,0,6ZM12,15A10.98985,10.98985,0,0,1,32.41406,9.33643a1.00013,1.00013,0,0,0,1.40576.31884A3.95474,3.95474,0,0,1,36,9a4.00458,4.00458,0,0,1,4,4v7.10107A5.00068,5.00068,0,0,0,39,20H38v-.66846a3.33116,3.33116,0,0,0-5.09668-2.82519,13.10317,13.10317,0,0,1-13.80615.00049A3.33093,3.33093,0,0,0,14,19.33154V20H13a5.00068,5.00068,0,0,0-1,.10107Zm1,13a3,3,0,0,1,0-6h1v6Zm3,0V19.33154a1.33112,1.33112,0,0,1,2.03711-1.1289,15.116,15.116,0,0,0,15.92627-.00049A1.33135,1.33135,0,0,1,36,19.33154V28a10,10,0,0,1-20,0ZM2,49.58008a7.03254,7.03254,0,0,1,4.5752-6.57129L7,42.85248V60H2Z"
style="fill:#2a2b35"
/>
</g>
</svg>
"""
end
def footer(assigns) do
assigns =
assign(assigns,
usher_version: Application.spec(:usher, :vsn),
usher_web_version: Application.spec(:usher_web, :vsn)
)
~H"""
<footer class={[
"flex flex-col p-2 text-sm justify-center items-center md:flex-row"
]}>
<.version name="Usher" version={@usher_version} />
<.version name="Usher.Web" version={@usher_web_version} />
</footer>
"""
end
defp version(assigns) do
~H"""
<span class="text-gray-600 dark:text-gray-400 tabular mr-0 mb-1 md:mr-3 md:mb-0">
{@name} {if @version, do: "v#{@version}", else: "–"}
</span>
"""
end
end