Skip to content

Commit

Permalink
Merge pull request #104 from pepicrft/redesign
Browse files Browse the repository at this point in the history
Redesign the website
  • Loading branch information
pepicrft authored Jun 22, 2024
2 parents 2b86a1d + 5fc6a53 commit 4b79017
Show file tree
Hide file tree
Showing 29 changed files with 509 additions and 277 deletions.
4 changes: 4 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tools]
elixir="1.17.0"
erlang="27.0"
flyctl="0.1.104"
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"editor.defaultFormatter": "saratravi.elixir-formatter",
"files.associations": {
"*.heex": "phoenix-heex",
},
"emmet.includeLanguages": {
"phoenix-heex": "html"
},
Expand All @@ -10,7 +12,8 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[phoenix-heex]": {
"editor.defaultFormatter": "RoyalMist.vscode-eex-format"
"editor.formatOnSave": true,
"editor.defaultFormatter": "JakeBecker.elixir-ls"
},
"grammarly.selectors": [
{
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# - https://pkgs.org/ - resource for finding needed packages
# - Ex: hexpm/elixir:1.13.4-erlang-25.0.4-debian-bullseye-20210902-slim
#
ARG ELIXIR_VERSION=1.16.2
ARG OTP_VERSION=26.2.3
ARG DEBIAN_VERSION=buster-20240130-slim
ARG ELIXIR_VERSION=1.17.0
ARG OTP_VERSION=27.0
ARG DEBIAN_VERSION=buster-20240612-slim

ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ config :pepicrft, :metadata,
github_url: "https://github.com/pepicrft",
language: "en-us",
twitter_handle: "@pepicrft",
mastodon_url: "https://mastodon.social/@pepicrft",
mastodon_url: "https://masto.pepicrft.me/@pedro",
linkedin_url: "https://www.linkedin.com/in/pedro-pi%C3%B1era-buendia-9765a9125/",
author: "Pedro Piñera"

Expand Down
32 changes: 11 additions & 21 deletions lib/pepicrft_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,22 @@ defmodule PepicrftWeb.CoreComponents do
end

~H"""
<div class="pp-Posts">
<ul class="pp-Posts">
<%= for post <- assigns.posts() do %>
<% {:ok, time_ago_date} =
Elixir.Timex.Format.DateTime.Formatters.Relative.format(post.date, "{relative}") %>
<% date_as_string =
Timex.format!(post.date, "%Y.%m.%d", :strftime) %>
<% post_attributes = %{href: post.slug} %>
<a {post_attributes} class="pp-PostItem_Link">
<div class="pp-PostItem">
<div class="pp-PostItem_Date"><%= time_ago_date %></div>
<h2 class="pp-PostItem_Title">
<li class="pp-PostItem">
<a class="pp-PostItem__Link" {post_attributes}>
<span class="pp-PostItem_Date"><%= date_as_string %></span>
<span class="pp-PostItem_Title">
<%= post.title %>
</h2>
<p class="pp-PostItem_Description"><%= post.description %></p>
</div>
</a>
</span>
</a>
</li>
<% end %>
</div>
"""
end

def description(assigns) do
~H"""
<p class="pp-Header_Navigation-Description">
I created <a href="https://github.com/tuist/xcodeproj">XcodeProj</a>
and <a href="https://github.com/tuist/tuist">Tuist</a>. My work is trusted by companies like <a href="https://adidas.com">Adidas</a>, <a href="https://www.americanexpress.com">American Express</a>, and <a href="https://etsy.com">Etsy</a>. I enjoy building delightful tools for developers and open-source communities.
</p>
</ul>
"""
end

Expand Down
3 changes: 0 additions & 3 deletions lib/pepicrft_web/components/layouts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ defmodule PepicrftWeb.Layouts do
url = %{url | path: "/blog/feed.xml"}
url |> URI.to_string()
end

def something do
end
end
42 changes: 21 additions & 21 deletions lib/pepicrft_web/components/layouts/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="csrf-token" content={get_csrf_token()}>
<link phx-track-static rel="stylesheet" href="/styles/app.css"/>
<link phx-track-static rel="stylesheet" href="/styles/bundle.css"/>
<script defer phx-track-static type="text/javascript" src="/assets/app.js"></script>

<!-- Meta -->
Expand All @@ -27,29 +26,30 @@
</head>

<body class="pp-Body">
<header>
<nav class="pp-Header_Navigation">
<a href={~p"/"}>
<img class="pp-Header_Navigation-Avatar" src="https://gravatar.com/avatar/978dc676705e45bbf504152a516afb36?s=400&d=robohash&r=x"/>
</a>

<a class="pp-Header_Navigation-Title" href={~p"/about"}>Pedro Piñera</a>
</nav>
</header>
<nav class="pp-Navigation">
<ul class="pp-Navigation_List">
<a class="pp-Navigation_List_Title" href={~p"/"}>Pedro Piñera</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href={~p"/about"}>About</a><div class="pp-Navigation_List_Arrow"><%= raw if @request_path == ~p"/about", do: "", else: "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href={~p"/projects"}>Projects</a><div class="pp-Navigation_List_Arrow"><%= raw if @request_path == ~p"/projects", do: "", else: "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href={~p"/feed"}>Feed</a><div class="pp-Navigation_List_Arrow"><%= raw if @request_path == ~p"/feed", do: "", else: "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href={~p"/photos"}>Photos</a><div class="pp-Navigation_List_Arrow"><%= raw if @request_path == ~p"/photos", do: "", else: "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href={~p"/now"}>Now</a><div class="pp-Navigation_List_Arrow"><%= raw if @request_path == ~p"/now", do: "", else: "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href={~p"/blog/feed.xml"}>RSS</a><div>&nbsp;</div>
<a class="pp-Navigation_List_Link" href={~p"/pdfs/CV.pdf"}>CV</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
</ul>

<ul class="pp-Navigation_List">
<a class="pp-Navigation_List_Title" href={~p"/"}>On the Internet</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href="https://mastodon.social/@pepicrft">Mastodon</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href="https://x.com/pepicrft">X</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href="https://github.com/pepicrft">GitHub</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href="https://www.linkedin.com/in/pedro-piñera-buendia-9765a9125/">LinkedIn</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
<a class="pp-Navigation_List_Link" href="https://codeberg.org/pepicrft/">Codeberg</a><div class="pp-Navigation_List_Arrow"><%= raw "&nbsp;" %></div>
</ul>
</nav>

<main class="pp-Main">
<%= @inner_content %>
</main>

<footer>
<nav class="pp-Footer_Navigation">
<a class="pp-Footer_Navigation-Item" href="https://x.com/pepicrft" target="_blank">X</a>
<a class="pp-Footer_Navigation-Item" href="https://mastodon.social/@pepicrft" target="_blank">Mastodon</a>
<a class="pp-Footer_Navigation-Item" href="https://codeberg.org/pepicrft" target="_blank">Codeberg</a>
<a class="pp-Footer_Navigation-Item" href="https://www.linkedin.com/in/pedro-piñera-buendia-9765a9125/" target="_blank">LinkedIn</a>
<a class="pp-Footer_Navigation-Item" href="https://github.com/pepicrft" target="_blank">GitHub</a>
<a class="pp-Footer_Navigation-Item" href={~p"/blog/feed.xml"} target="_blank">Feed</a>
</nav>
</footer>
</body>
</html>
11 changes: 3 additions & 8 deletions lib/pepicrft_web/controllers/blog_html/show.html.heex
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<% {:ok, time_ago_date} = Elixir.Timex.Format.DateTime.Formatters.Relative.format(@post.date, "{relative}") %>
<p class="pp-Post_TimeAgo"><%= time_ago_date %></p>

<% date_as_string = Timex.format!(@post.date, "%Y.%m.%d", :strftime) %>
<h1 class="pp-Post_Title"><%= @post.title %></h1>
<p class="pp-Post_TimeAgo"><%= date_as_string %></p>

<div class="pp-Post_Body">
<%= raw @post.body %>
</div>


<div>
<a class="pp-Blog_About-Title" href={~p"/about"}>About Pedro Piñera</a>
<.description/>
</div>
24 changes: 24 additions & 0 deletions lib/pepicrft_web/controllers/home_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,28 @@ defmodule PepicrftWeb.HomeController do
def about(conn, _params) do
render(conn, :about)
end

def projects(conn, _params) do
render(conn, :projects)
end

def feed(conn, _params) do
%{body: statuses} =
Req.get!("https://masto.pepicrft.me/api/v1/accounts/112545800553693985/statuses")

render(conn, :feed, statuses: statuses)
end

def photos(conn, _params) do
%{body: statuses} =
Req.get!(
"https://camera.pepicrft.me/api/pixelfed/v1/accounts/702760890334240769/statuses?only_media=true&min_id=1"
)

render(conn, :photos, statuses: statuses)
end

def now(conn, _params) do
render(conn, :now)
end
end
4 changes: 2 additions & 2 deletions lib/pepicrft_web/controllers/home_html/about.html.heex
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<h1 id="about">
<a href="#about">About</a>
<a href="#about">About 🧑🏻‍💻</a>
</h1>

<p>
Hola 👋,
</p>
<p>
I'm a Berlin-based builder. For the past ten years, I have been a hands-on and adaptable problem solver, collaborating with start-ups and e-commerce platforms and building open-source solutions like <a href="https://tuist.io" target="_blank">Tuist</a>. I'm currently bootstrapping <b><a href="https://tuist.io/cloud">Tuist Cloud</a></b>.
I'm a Berlin-based builder. For the past ten years, I have been a hands-on and adaptable problem solver, collaborating with start-ups and <a href="https://shopify.com">e-commerce platforms</a> and building open-source solutions like <a href="https://tuist.io" target="_blank">Tuist</a>. I'm currently working with <a href="https://www.linkedin.com/in/marek-f-71853b89/">Marek</a> on turning Tuist into a sustainable business.
</p>
<p>
My work is trusted by <a target="_blank" href="https://shopify.com">Shopify</a>, <a target="_blank" href="https://americanexpress.com">American Express</a>, <a target="_blank" href="https://soundcloud.com">SoundCloud</a>, <a target="_blank" href="https://shopify.com">Bloomberg</a>, <a target="_blank" href="https://stripe.com" >Stripe</a>, <a target="_blank" href="https://google.com">Google</a>, <a target="_blank" href="https://monday.com">Monday</a>, <a target="_blank" href="https://justeat.com">Just Eat</a>, <a target="_blank" href="https://etsy.com">Etsy</a>, and <a target="_blank" href="https://adidas.com">Adidas</a>.
Expand Down
34 changes: 34 additions & 0 deletions lib/pepicrft_web/controllers/home_html/feed.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<h1 id="feed">
<a href="#feed">Feed 📋</a>
</h1>

<section class="pp-Feed-List">
<%= for status <- @statuses do %>
<% content = status["content"] %>
<% media = status["media_attachments"] %>
<% url = status["url"] %>
<%= if String.trim(content) != "" do %>
<article class="pp-Feed-List_Post">
<a class="pp-Feed-List_Post_Link" href={url}>Link</a>
<%= raw content %>
<%= if media != [] do %>
<div class="pp-Feed-List_Post_Media">
<%= for m <- media do %>
<%= case m["type"] do %>
<% "gifv" -> %>
<video autoplay loop muted playsinline class="pp-Feed-List_Post_Media_Image">
<source src={m["url"]} type="video/mp4">
</video>
<% _ -> %>
<a href={m["url"]} target="_blank">
<img src={m["url"]} alt={m["description"]} class="pp-Feed-List_Post_Media_Image"/>
</a>
<% end %>
<% end %>
</div>
<% end %>
</article>
<hr>
<% end %>
<% end %>
</section>
4 changes: 3 additions & 1 deletion lib/pepicrft_web/controllers/home_html/index.html.heex
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<.description/>
<h1 id="writing">
<a href="#writing">Writing ✏️</a>
</h1>
<.posts_component posts={Pepicrft.Blog.all_posts()}/>
37 changes: 37 additions & 0 deletions lib/pepicrft_web/controllers/home_html/now.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<h1 id="now">
<a href="#now">Now</a>
</h1>

<p>
The following is a list of things that I'm doing, thinking about, or working on right now.
</p>

<h2 id="mental-health">
<a href="#mental-health">Mental health</a>
</h2>

<p>I'm working on better understanding my emotions and reverting some anxiety-inducing habits that I've developed over the years.</p>


<h2 id="work">
<a href="#work">Work</a>
</h2>
<p>
I'm learning a lot about business while trying to build a company upon the open-source work that I've been doing for the past few years. It's a whole new world of ideas of concepts for me, but I'm quite liking it. It reminds me of my childhood working at my family cafe, but at a different scale.
</p>


<h2 id="the-web-platform">
<a href="#the-web-platform">The web platform</a>
</h2>
<p>
I haven't worked much with the web in the past, and whenever I did, it was mostly to build my personal website by using a template, a static site generator, and working with many abstractions (e.g. TailwindCSS). This time, I'm playing with the web in its most raw form–writing HTML, CSS, and JavaScript from scratch. I'm getting familiar with the semantics of HTML elements, as well as the common CSS properties.
</p>

<h2 id="elixir">
<a href="#elixir">Elixir</a>
</h2>

<p>
As part of my work on Tuist, I'm learning a lot about Elixir, and the more I learn, the more I like it. I'm fascinated by the language's simplicity and the way it leverages the Erlang VM to build robust and fault-tolerant systems. I'm also learning about OTP, the framework that Elixir provides to build distributed systems.
</p>
15 changes: 15 additions & 0 deletions lib/pepicrft_web/controllers/home_html/photos.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<h1 id="photos">
<a href="#photos">Photos 📸</a>
</h1>

<section>
<%= for status <- @statuses do %>
<% %{"url" => url, "content" => content, "media_attachments" => [ %{"url" => image_url, "description" => image_alt} | _]} = status %>
<article>
<h2>
<a href={url}><%= content %></a>
</h2>
<img class="pp-Photos_Image" src={image_url} alt={image_alt}/>
</article>
<% end %>
</section>
32 changes: 32 additions & 0 deletions lib/pepicrft_web/controllers/home_html/projects.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h1 id="projects">
<a href="#projects">Projects 📦</a>
</h1>

<p>
The following sections describe the projects that I created and/or that I contribute/d to.
</p>

<h2 id="tuist">
<a href="#tuist">Tuist</a>
</h2>

<p>
<a href="https://tuist.io">Tuist</a> is a Swifty toolchain to build better Apple apps faster. I created it in 2017, and we are currently working on building a long-term business around it by
</p>

<h2 id="xcodeproj">
<a href="#xcodeproj">XcodeProj</a>
</h2>

<p>
<a href="https://github.com/tuist/xcodeproj">XcodeProj</a> is an open-source Swift package to read, update, and write Xcode projects. I created it in 2017 as part of Tuist, and it has become a popular library in the Swift community.
</p>


<h2 id="shopify-cli">
<a href="#shopify-cli">Shopify CLI</a>
</h2>

<p>
<a href="https://github.com/shopify/cli">Shopify CLI</a> I overhauled the tech stack of the Shopify CLI, which developers use to build for the platform, to align it with the platform's technologies.
</p>
10 changes: 9 additions & 1 deletion lib/pepicrft_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ defmodule PepicrftWeb.Router do
end

scope "/", PepicrftWeb do
pipe_through :browser
pipe_through [:browser, :put_current_url]

get "/", HomeController, :index
get "/about", HomeController, :about
get "/projects", HomeController, :projects
get "/feed", HomeController, :feed
get "/photos", HomeController, :photos
get "/now", HomeController, :now
get "/blog/:year/:month/:day/:title", BlogController, :show

for page <- Pepicrft.Pages.all_pages() do
Expand Down Expand Up @@ -69,4 +73,8 @@ defmodule PepicrftWeb.Router do
forward "/mailbox", Plug.Swoosh.MailboxPreview
end
end

def put_current_url(conn, _params) do
Plug.Conn.assign(conn, :request_path, conn.request_path)
end
end
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ defmodule Pepicrft.MixProject do
{:phoenix_html_sanitizer, "~> 1.1.1"},
{:image, "~> 0.48.0"},
{:file_system, "~> 0.2"},
{:remote_ip, "~> 1.1"}
{:remote_ip, "~> 1.1"},
{:req, "~> 0.5.0"}
]
end

Expand Down
Loading

0 comments on commit 4b79017

Please sign in to comment.