more style / layout updates
This commit is contained in:
parent
4f2f2bb3fd
commit
58dffeadb3
11 changed files with 36 additions and 44 deletions
|
@ -17,6 +17,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
require('@tailwindcss/forms'),
|
require('@tailwindcss/forms'),
|
||||||
|
require('@tailwindcss/typography'),
|
||||||
plugin(({addVariant}) => addVariant('phx-no-feedback', ['&.phx-no-feedback', '.phx-no-feedback &'])),
|
plugin(({addVariant}) => addVariant('phx-no-feedback', ['&.phx-no-feedback', '.phx-no-feedback &'])),
|
||||||
plugin(({addVariant}) => addVariant('phx-click-loading', ['&.phx-click-loading', '.phx-click-loading &'])),
|
plugin(({addVariant}) => addVariant('phx-click-loading', ['&.phx-click-loading', '.phx-click-loading &'])),
|
||||||
plugin(({addVariant}) => addVariant('phx-submit-loading', ['&.phx-submit-loading', '.phx-submit-loading &'])),
|
plugin(({addVariant}) => addVariant('phx-submit-loading', ['&.phx-submit-loading', '.phx-submit-loading &'])),
|
||||||
|
|
|
@ -9,7 +9,7 @@ defmodule SloaneSH.Config do
|
||||||
typedstruct do
|
typedstruct do
|
||||||
field :pages_dir, String.t(), enforce: true
|
field :pages_dir, String.t(), enforce: true
|
||||||
field :posts_dir, String.t(), enforce: true
|
field :posts_dir, String.t(), enforce: true
|
||||||
field :output, String.t(), enforce: true
|
field :output_dir, String.t(), enforce: true
|
||||||
end
|
end
|
||||||
|
|
||||||
def default do
|
def default do
|
||||||
|
@ -18,7 +18,7 @@ defmodule SloaneSH.Config do
|
||||||
%Config{
|
%Config{
|
||||||
pages_dir: Path.join(priv, "site/pages"),
|
pages_dir: Path.join(priv, "site/pages"),
|
||||||
posts_dir: Path.join(priv, "site/posts"),
|
posts_dir: Path.join(priv, "site/posts"),
|
||||||
output: Path.join(priv, "output")
|
output_dir: Path.join(priv, "output")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,7 @@ defmodule SloaneSH.Layouts do
|
||||||
:attrs,
|
:attrs,
|
||||||
:inner_content
|
:inner_content
|
||||||
])
|
])
|
||||||
|
|
||||||
|
defp prefix_title(prefix, nil), do: prefix
|
||||||
|
defp prefix_title(prefix, page_title), do: [prefix, " | ", page_title]
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,13 +8,18 @@ defmodule SloaneSH.Layouts.Partials do
|
||||||
:def,
|
:def,
|
||||||
:header,
|
:header,
|
||||||
~S"""
|
~S"""
|
||||||
<header class="flex flex-col gap-2">
|
<header class="flex flex-row justify-between gap-2 border-b border-neutral-700 pb-4 mb-2">
|
||||||
<a href="/"><h1 class="text-xl">sloane.sh</h1></a>
|
<%= if attrs[:title] do %>
|
||||||
<nav class="flex flex-row gap-2">
|
<h1 class="text-3xl font-bold"><%= attrs[:title] %></h1>
|
||||||
|
<% end %>
|
||||||
|
<div class="flex flex-col gap-2 <%= cx("items-end": attrs[:title]) %>">
|
||||||
|
<a href="/"><h1 class="text-2xl">sloane.sh</h1></a>
|
||||||
|
<nav class="flex flex-row gap-2 text-lg">
|
||||||
<a href="/" class="<%= cx(underline: attrs[:permalink] == "/") %>">home</a>
|
<a href="/" class="<%= cx(underline: attrs[:permalink] == "/") %>">home</a>
|
||||||
<a href="/about" class="<%= cx(underline: attrs[:permalink] == "/about") %>">about</a>
|
<a href="/writing" class="<%= cx(underline: Map.get(attrs, :permalink, "") =~ ~r[^/posts]) %>">writing</a>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</div>
|
||||||
|
</header>
|
||||||
""",
|
""",
|
||||||
[:ctx, :attrs]
|
[:ctx, :attrs]
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,6 +6,7 @@ defmodule SloaneSH.Markdown do
|
||||||
use TypedStruct
|
use TypedStruct
|
||||||
|
|
||||||
alias SloaneSH.Context
|
alias SloaneSH.Context
|
||||||
|
alias SloaneSH.FrontMatter
|
||||||
alias __MODULE__
|
alias __MODULE__
|
||||||
|
|
||||||
typedstruct do
|
typedstruct do
|
||||||
|
@ -15,22 +16,10 @@ defmodule SloaneSH.Markdown do
|
||||||
|
|
||||||
def transform(%Context{} = ctx, data) when is_binary(data) do
|
def transform(%Context{} = ctx, data) when is_binary(data) do
|
||||||
data
|
data
|
||||||
|> parse_attrs(ctx)
|
|> FrontMatter.parse(ctx)
|
||||||
|> parse_markdown(ctx)
|
|> parse_markdown(ctx)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp parse_attrs("+++" <> rest, _ctx) do
|
|
||||||
[toml, body] = String.split(rest, ["+++\n", "+++\r\n"], parts: 2)
|
|
||||||
|
|
||||||
with {:ok, attrs} <- Toml.decode(toml, keys: :atoms) do
|
|
||||||
{:ok, attrs, body}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp parse_attrs(body, _ctx) do
|
|
||||||
{:ok, %{}, body}
|
|
||||||
end
|
|
||||||
|
|
||||||
defp parse_markdown({:ok, attrs, body}, _ctx) do
|
defp parse_markdown({:ok, attrs, body}, _ctx) do
|
||||||
with {:ok, html, msgs} <- Earmark.as_html(body) do
|
with {:ok, html, msgs} <- Earmark.as_html(body) do
|
||||||
for msg <- msgs, do: Logger.warning(msg)
|
for msg <- msgs, do: Logger.warning(msg)
|
||||||
|
|
|
@ -12,7 +12,7 @@ defmodule SloaneSH.Write do
|
||||||
end
|
end
|
||||||
|
|
||||||
def write(ctx, name, data) do
|
def write(ctx, name, data) do
|
||||||
path = Path.join(ctx.config.output, name)
|
path = Path.join(ctx.config.output_dir, name)
|
||||||
|
|
||||||
with :ok <- File.mkdir_p(Path.dirname(path)) do
|
with :ok <- File.mkdir_p(Path.dirname(path)) do
|
||||||
File.write(path, data)
|
File.write(path, data)
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
<%= inner_content %>
|
<%= header(ctx, attrs) %>
|
||||||
|
<main class="prose-neutral prose prose-xl dark:prose-invert">
|
||||||
|
<%= inner_content %>
|
||||||
|
</main>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%= if attrs[:title] do %>
|
<%= header(ctx, attrs) %>
|
||||||
<h2 class="font-sans font-bold text-lg"><%= attrs[:title] %></h2>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= inner_content %>
|
<article class="prose-neutral prose prose-xl dark:prose-invert">
|
||||||
|
<%= inner_content %>
|
||||||
|
</article>
|
||||||
|
|
|
@ -3,13 +3,10 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>sloane.sh | <%= attrs[:title] %></title>
|
<title><%= prefix_title("sloane.sh", attrs[:page_title]) %></title>
|
||||||
<link rel="stylesheet" href="/assets/app.css" />
|
<link rel="stylesheet" href="/assets/app.css" />
|
||||||
</head>
|
</head>
|
||||||
<body class="w-full max-w-3xl bg-white text-black dark:bg-neutral-800 dark:text-neutral-100">
|
<body class="w-full max-w-3xl bg-white text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100">
|
||||||
<%= header(ctx, attrs) %>
|
<%= inner_content %>
|
||||||
<main class="mt-6">
|
|
||||||
<%= inner_content %>
|
|
||||||
</main>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
+++
|
|
||||||
permalink = "/about"
|
|
||||||
title = "about"
|
|
||||||
+++
|
|
||||||
|
|
||||||
Yes it does!!
|
|
|
@ -1,12 +1,12 @@
|
||||||
+++
|
+++
|
||||||
permalink = "/"
|
permalink = "/"
|
||||||
title = "home"
|
page_title = "home"
|
||||||
+++
|
+++
|
||||||
|
|
||||||
# Hello, World!
|
hey, i'm sloane! i'm a professional software engineer and an amateur musician, photographer, wife, chef, and pet mom.
|
||||||
|
|
||||||
my name is sloane. i am a software engineer.
|
#### around the web
|
||||||
|
|
||||||
i'm on the fediverse [@sloane@tech.lgbt](https://tech.lgbt/@sloane)
|
- [@sloane](https://tech.lgbt/@sloane) on the fediverse
|
||||||
|
- [@sloanelybutsurely](https://github.com/sloanelybutsurely) on github
|
||||||
also on [github](https://github.com/sloanelybutsurely).
|
- [@sloane_of_arc](https://instagram.com/sloane_of_arc) on instagram
|
||||||
|
|
Loading…
Reference in a new issue