diff --git a/assets/css/app.css b/assets/css/app.css index 7df1242..a517edc 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -3,18 +3,31 @@ @import "tailwindcss/utilities"; html { - --base-font-size: 16.666667; - --base-line-height: 1.32; + --base-font-size: 20; + --base-line-height: 1.3; --font-size: calc(var(--base-font-size) * 1px); --line-height: calc(var(--base-line-height) * 1rem); --base-vspace: calc(var(--base-line-height) * var(--base-font-size)); --vspace: calc(var(--base-vspace) * 1px); + --line-trim: -0.6666666666666667px; font-size: var(--font-size); line-height: var(--line-height); } .container { - max-width: 80ch; + max-width: 65ch; +} + +a { + @apply text-blue; +} + +a::before { + /* content: "⇲"; */ +} + +nav a { + @apply text-dark; } .box { @@ -28,6 +41,14 @@ p { margin-bottom: var(--vspace); } +a { + display: inline-block; +} + +a:hover { + @apply bg-light text-dark; +} + @font-face { font-family: "JetBrainsMono"; src: url("/fonts/JetBrainsMono-VariableFont_wght.ttf"); diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 37290af..633faeb 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -17,7 +17,7 @@ module.exports = { blue: 'rgb(93, 110, 238)', magenta: 'rgb(211, 48, 233)', cyan: 'rgb(139, 243, 231)', - light: 'rgb(181, 190, 255)' + light: 'rgb(218, 222, 255)'// 'rgb(181, 190, 255)' }, fontSize: { // xs: ['0.75rem', { lineHeight: '1rem' }], diff --git a/lib/pre_dot_hn.ex b/lib/pre_dot_hn.ex index d3743e2..45e82a9 100644 --- a/lib/pre_dot_hn.ex +++ b/lib/pre_dot_hn.ex @@ -37,27 +37,61 @@ defmodule PreDotHn do def validate(other), do: {:ok, other} def run() do - "site/**/*.md" - |> Path.wildcard() - |> Enum.map(&read/1) - |> Enum.map(&validate/1) - |> Enum.filter(fn - {:error, error} -> - Logger.warn(error) + posts = + "site/**/*.md" + |> Path.wildcard() + |> Enum.map(&read/1) + |> Enum.map(&validate/1) + |> Enum.filter(fn + {:error, error} -> + Logger.warn(error) - false + false - {:ok, _other} -> - true - end) - |> Enum.map(fn {:ok, page} -> - page = - page |> Enum.map(fn {key, value} -> {String.to_atom(key), value} end) |> Enum.into(%{}) + {:ok, _other} -> + true + end) + |> Enum.map(&elem(&1, 1)) + |> Enum.sort_by(&Map.get(&1, "date"), :desc) + |> Enum.map(&atomize_keys/1) - write_page(page) - end) + index = make_index(posts) + + Enum.map([index | posts], &write_page/1) end + def atomize_keys(page) do + page + |> Enum.map(fn {key, value} -> {String.to_atom(key), value} end) + |> Enum.into(%{}) + end + + def make_index(posts) do + assigns = %{posts: posts} + + body = + ~H""" + + """ + |> rendered_to_string() + + %{ + title: "Blog", + slug: "blog", + date: "2023-09-23", + body: body + } + end + + attr(:title, :string, required: true) + attr(:description, :string) slot(:inner_block, required: true) def layout(assigns) do @@ -68,9 +102,11 @@ defmodule PreDotHn do - A Basic HTML5 Template - - + <%= @title %> | Robert Prehn + <%= if assigns[:description] do %> + + <% end %> + @@ -81,18 +117,34 @@ defmodule PreDotHn do - <%= render_slot(@inner_block) %> + <.menu /> + <%= render_slot(@inner_block) %> """ end + def menu(assigns) do + ~H""" + + """ + end + def write_page(%{slug: slug} = assigns) do - filename = "#{slug}.html" - path = Path.join(["priv", "static", filename]) + path = + if slug == "index" do + Path.join(["priv", "static", "index.html"]) + else + directory = Path.join(["priv", "static", slug]) + File.mkdir_p!(directory) + Path.join(["priv", "static", slug, "index.html"]) + end ~H""" - <.layout> + <.layout title={@title} description={assigns[:description]}>
<%= {:safe, @body} %> diff --git a/lib/pre_dot_hn/markdown.ex b/lib/pre_dot_hn/markdown.ex index 9851409..228ad47 100644 --- a/lib/pre_dot_hn/markdown.ex +++ b/lib/pre_dot_hn/markdown.ex @@ -19,20 +19,6 @@ defmodule PreDotHn.Markdown do |> Earmark.Transform.transform() end - defp transformer({"a", attrs, ignored, %{wikilink: true} = meta}) do - attrs = - attrs - |> Enum.map(fn - {"href", href} -> - {"href", "/notes#{href}"} - - other -> - other - end) - - {"a", attrs, ignored, meta} - end - defp transformer({"a", attrs, ignored, meta}) do href = Enum.find_value(attrs, "", fn {key, value} -> key == "href" && value end) href_uri = URI.parse(href) diff --git a/site/pages/about.md b/site/pages/about.md index 1af1623..1110d4e 100644 --- a/site/pages/about.md +++ b/site/pages/about.md @@ -6,11 +6,11 @@ slug: index My name is Robert Prehn. -I'm a software engineering leader and independent consultant. You can hire me to help your software team to ship products better and faster. I'm also a Worker-Owner at [Mythic Insight](https: //www.mythicinsight.com/). +I'm a software engineering leader and independent consultant. You can hire me to help your software team to ship products better and faster. I'm also a Worker-Owner at [Mythic Insight](https://www.mythicinsight.com/). A better future is possible!

Photo of Robert Prehn - Robert Prehn | Public Key | GitHub | Keybase | Fediverse + Robert Prehn | Public Key | GitHub | Keybase | Fediverse