From bee6b0ea0f92b37b83ab77d6901c7a459e459f0d Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 6 Mar 2021 21:03:38 -0300 Subject: [PATCH 01/52] wip: create article page --- apps/web/assets/tailwind.config.js | 9 ++++++- apps/web/lib/web/live/article_live.ex | 28 ++++++++++++++++++++ apps/web/lib/web/live/article_live.html.leex | 13 +++++++++ apps/web/lib/web/router.ex | 1 + 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 apps/web/lib/web/live/article_live.ex create mode 100644 apps/web/lib/web/live/article_live.html.leex diff --git a/apps/web/assets/tailwind.config.js b/apps/web/assets/tailwind.config.js index 6350f16..ab0bfdc 100644 --- a/apps/web/assets/tailwind.config.js +++ b/apps/web/assets/tailwind.config.js @@ -6,7 +6,14 @@ module.exports = { ], darkMode: false, // or 'media' or 'class' theme: { - extend: {}, + container: { + center: true, + }, + extend: { + screens: { + 'sm': '680px' + }, + }, }, variants: { extend: {}, diff --git a/apps/web/lib/web/live/article_live.ex b/apps/web/lib/web/live/article_live.ex new file mode 100644 index 0000000..81b99d5 --- /dev/null +++ b/apps/web/lib/web/live/article_live.ex @@ -0,0 +1,28 @@ +defmodule Web.ArticleLive do + use Phoenix.LiveView + import Phoenix.HTML, only: [raw: 1] + + @meta %{ + title: "branchpage title", + description: "some description", + social_image: "/images/cover.png" + } + + @impl true + def mount(%{"username" => _username, "article" => _}, _session, socket) do + name = "Felipe Lincoln" + date = DateTime.utc_now() + title = "Lorem ipsum dolor sit amet. Consectetur adipiscing elit." + body_html = "

iasjdiajdis

Life is waterfall

" + + socket = + socket + |> assign(@meta) + |> assign(:name, name) + |> assign(:date, date) + |> assign(:title, title) + |> assign(:body_html, body_html) + + {:ok, socket} + end +end diff --git a/apps/web/lib/web/live/article_live.html.leex b/apps/web/lib/web/live/article_live.html.leex new file mode 100644 index 0000000..23a38dc --- /dev/null +++ b/apps/web/lib/web/live/article_live.html.leex @@ -0,0 +1,13 @@ +
+ + + <%= @name %> + + + Edit on GitHub +
+
+

<%= @date %>

+ <%= @title %> + <%= raw @body_html %> +
diff --git a/apps/web/lib/web/router.ex b/apps/web/lib/web/router.ex index 03c1174..7c6875c 100644 --- a/apps/web/lib/web/router.ex +++ b/apps/web/lib/web/router.ex @@ -12,5 +12,6 @@ defmodule Web.Router do pipe_through :browser live "/", HomeLive + live "/:username/:article", ArticleLive end end From 29f7b1db9655040510f6e7dedaa72ca597569309 Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 6 Mar 2021 21:23:03 -0300 Subject: [PATCH 02/52] format date with timex --- apps/web/lib/web/live/article_live.ex | 2 +- apps/web/lib/web/live/article_live.html.leex | 9 ++++++--- apps/web/mix.exs | 3 ++- config/dev.exs | 2 +- mix.lock | 12 ++++++++++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/apps/web/lib/web/live/article_live.ex b/apps/web/lib/web/live/article_live.ex index 81b99d5..a0b66f4 100644 --- a/apps/web/lib/web/live/article_live.ex +++ b/apps/web/lib/web/live/article_live.ex @@ -11,7 +11,7 @@ defmodule Web.ArticleLive do @impl true def mount(%{"username" => _username, "article" => _}, _session, socket) do name = "Felipe Lincoln" - date = DateTime.utc_now() + date = Timex.today() |> Timex.format!("%b %e", :strftime) title = "Lorem ipsum dolor sit amet. Consectetur adipiscing elit." body_html = "

iasjdiajdis

Life is waterfall

" diff --git a/apps/web/lib/web/live/article_live.html.leex b/apps/web/lib/web/live/article_live.html.leex index 23a38dc..e306f8f 100644 --- a/apps/web/lib/web/live/article_live.html.leex +++ b/apps/web/lib/web/live/article_live.html.leex @@ -7,7 +7,10 @@ Edit on GitHub
-

<%= @date %>

- <%= @title %> - <%= raw @body_html %> +

<%= @date %>

+

<%= @title %>

+ +
+ <%= raw @body_html %> +
diff --git a/apps/web/mix.exs b/apps/web/mix.exs index b2e15f4..777b7bd 100644 --- a/apps/web/mix.exs +++ b/apps/web/mix.exs @@ -30,7 +30,8 @@ defmodule Web.MixProject do {:phoenix_live_view, "~> 0.15.4"}, {:phoenix_live_reload, "~> 1.3"}, {:plug_cowboy, "~> 2.0"}, - {:jason, "~> 1.2"} + {:jason, "~> 1.2"}, + {:timex, "~> 3.0"} ] end end diff --git a/config/dev.exs b/config/dev.exs index 04d0572..d1ef2bf 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -2,7 +2,7 @@ import Config config :web, Web.Endpoint, http: [port: 4000], - debug_errors: false, + debug_errors: true, code_reloader: true, check_origin: false, live_reload: [ diff --git a/mix.lock b/mix.lock index d1807e6..7b723e8 100644 --- a/mix.lock +++ b/mix.lock @@ -1,10 +1,18 @@ %{ + "certifi": {:hex, :certifi, "2.5.3", "70bdd7e7188c804f3a30ee0e7c99655bc35d8ac41c23e12325f36ab449b70651", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "ed516acb3929b101208a9d700062d520f3953da3b6b918d866106ffa980e1c10"}, + "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"}, "cowlib": {:hex, :cowlib, "2.9.1", "61a6c7c50cf07fdd24b2f45b89500bb93b6686579b069a89f88cb211e1125c78", [:rebar3], [], "hexpm", "e4175dc240a70d996156160891e1c62238ede1729e45740bdd38064dad476170"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "gettext": {:hex, :gettext, "0.18.2", "7df3ea191bb56c0309c00a783334b288d08a879f53a7014341284635850a6e55", [:mix], [], "hexpm", "f9f537b13d4fdd30f3039d33cb80144c3aa1f8d9698e47d7bcbcc8df93b1f5c5"}, + "hackney": {:hex, :hackney, "1.17.0", "717ea195fd2f898d9fe9f1ce0afcc2621a41ecfe137fae57e7fe6e9484b9aa99", [:rebar3], [{:certifi, "~>2.5", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "64c22225f1ea8855f584720c0e5b3cd14095703af1c9fbc845ba042811dc671c"}, + "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "1.5.0", "203ef35ef3389aae6d361918bf3f952fa17a09e8e43b5aa592b93eba05d0fb8d", [:mix], [], "hexpm", "55a94c0f552249fc1a3dd9cd2d3ab9de9d3c89b559c2bd01121f824834f24746"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, + "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, "phoenix": {:hex, :phoenix, "1.5.7", "2923bb3af924f184459fe4fa4b100bd25fa6468e69b2803dfae82698269aa5e0", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "774cd64417c5a3788414fdbb2be2eb9bcd0c048d9e6ad11a0c1fd67b7c0d0978"}, "phoenix_html": {:hex, :phoenix_html, "2.14.3", "51f720d0d543e4e157ff06b65de38e13303d5778a7919bcc696599e5934271b8", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "efd697a7fff35a13eeeb6b43db884705cba353a1a41d127d118fda5f90c8e80f"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.0", "f35f61c3f959c9a01b36defaa1f0624edd55b87e236b606664a556d6f72fd2e7", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "02c1007ae393f2b76ec61c1a869b1e617179877984678babde131d716f95b582"}, @@ -14,5 +22,9 @@ "plug_cowboy": {:hex, :plug_cowboy, "2.4.1", "779ba386c0915027f22e14a48919a9545714f849505fa15af2631a0d298abf0f", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d72113b6dff7b37a7d9b2a5b68892808e3a9a752f2bf7e503240945385b70507"}, "plug_crypto": {:hex, :plug_crypto, "1.2.0", "1cb20793aa63a6c619dd18bb33d7a3aa94818e5fd39ad357051a67f26dfa2df6", [:mix], [], "hexpm", "a48b538ae8bf381ffac344520755f3007cc10bd8e90b240af98ea29b69683fc2"}, "ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"}, + "timex": {:hex, :timex, "3.6.4", "137a49450b8d1f80efff82de4b78ab9ad2e367f06346825704310599733f338b", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5 or ~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "f6fce3f07ab67f525043af5b1f68ed5fa12a41b9dab95a9a98bb6acfb30ecadc"}, + "tzdata": {:hex, :tzdata, "1.1.0", "72f5babaa9390d0f131465c8702fa76da0919e37ba32baa90d93c583301a8359", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "18f453739b48d3dc5bcf0e8906d2dc112bb40baafe2c707596d89f3c8dd14034"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } From 7ca17392759da00b76e33e2eb3e80f4c6188d020 Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sun, 7 Mar 2021 10:58:54 -0300 Subject: [PATCH 03/52] add next articles section --- apps/web/lib/web/live/article_live.ex | 21 +++++++++++++- apps/web/lib/web/live/article_live.html.leex | 29 ++++++++++++-------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/apps/web/lib/web/live/article_live.ex b/apps/web/lib/web/live/article_live.ex index a0b66f4..5a74ed0 100644 --- a/apps/web/lib/web/live/article_live.ex +++ b/apps/web/lib/web/live/article_live.ex @@ -13,7 +13,25 @@ defmodule Web.ArticleLive do name = "Felipe Lincoln" date = Timex.today() |> Timex.format!("%b %e", :strftime) title = "Lorem ipsum dolor sit amet. Consectetur adipiscing elit." - body_html = "

iasjdiajdis

Life is waterfall

" + + body_html = """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+

Suspendisse semper diam sit amet enim placerat, nec suscipit dolor efficitur. Suspendisse nec erat vitae felis dignissim rhoncus porta sit amet ipsum. Quisque consequat leo nec est hendrerit aliquet. Donec accumsan sem ut sapien placerat facilisis. Sed pharetra efficitur mi, quis condimentum ipsum egestas quis. Duis ultrices, nibh ut placerat tincidunt, elit dolor tincidunt orci, id ornare metus urna accumsan ex. Duis quis ullamcorper ex, blandit sagittis metus. Quisque urna mi, condimentum quis tortor non, maximus maximus felis. Suspendisse accumsan augue purus, ut pharetra nunc congue at.

+

Fusce sit amet euismod arcu. In hac habitasse platea dictumst. Morbi non ullamcorper turpis. Curabitur rutrum venenatis nisl, sit amet pharetra erat rhoncus non. Suspendisse et arcu vitae eros bibendum porta convallis vel dolor. Maecenas eget sodales ex. Vestibulum feugiat purus vitae risus ultrices, sed vehicula justo posuere. Nulla commodo, elit sed tincidunt facilisis, nunc nunc posuere ligula, bibendum auctor mi ante et augue. Pellentesque finibus facilisis ex, eget volutpat turpis aliquet ac. Nullam lectus erat, finibus sed purus eu, maximus commodo enim. Curabitur tincidunt justo nec justo laoreet sodales vitae a nibh.

+ """ + + next_artticles = [ + %{ + title: "Another lorem ipsum dolor sit amet. Consectetur adpiscing elit.", + link: "#" + }, + %{ + title: "Consectetur.", + link: "#" + } + ] socket = socket @@ -22,6 +40,7 @@ defmodule Web.ArticleLive do |> assign(:date, date) |> assign(:title, title) |> assign(:body_html, body_html) + |> assign(:next_articles, next_artticles) {:ok, socket} end diff --git a/apps/web/lib/web/live/article_live.html.leex b/apps/web/lib/web/live/article_live.html.leex index e306f8f..9c81610 100644 --- a/apps/web/lib/web/live/article_live.html.leex +++ b/apps/web/lib/web/live/article_live.html.leex @@ -1,16 +1,21 @@ - -
-

<%= @date %>

-

<%= @title %>

- -
+ +
+
+

<%= @date %>

+

<%= @title %>

+
<%= raw @body_html %> -
-
+ +
+
+ <%= for article <- @next_articles do %> +

<%= article.title %>

+ <% end %> +
+ From b43a7bcbd7ff91f2287783b651775240dc8a62b1 Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 13 Mar 2021 10:07:55 -0300 Subject: [PATCH 04/52] add blog page --- apps/web/lib/web/live/blog_live.ex | 32 +++++++++++++++++++++++ apps/web/lib/web/live/blog_live.html.leex | 30 +++++++++++++++++++++ apps/web/lib/web/router.ex | 1 + 3 files changed, 63 insertions(+) create mode 100644 apps/web/lib/web/live/blog_live.ex create mode 100644 apps/web/lib/web/live/blog_live.html.leex diff --git a/apps/web/lib/web/live/blog_live.ex b/apps/web/lib/web/live/blog_live.ex new file mode 100644 index 0000000..7ec54f2 --- /dev/null +++ b/apps/web/lib/web/live/blog_live.ex @@ -0,0 +1,32 @@ +defmodule Web.BlogLive do + use Phoenix.LiveView + import Phoenix.HTML, only: [raw: 1] + + @meta %{ + title: "branchpage title", + description: "some description", + social_image: "/images/cover.png" + } + + @impl true + def mount(%{"username" => _username}, _session, socket) do + articles = [ + %{ + title: "Lorem ipsum dolor sit amet. Consectetur adipiscing elit.", + date: Timex.today() |> Timex.format!("%b %e", :strftime), + body_html: """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+ """ + } + ] + + socket = + socket + |> assign(@meta) + |> assign(:articles, articles) + + {:ok, socket} + end +end diff --git a/apps/web/lib/web/live/blog_live.html.leex b/apps/web/lib/web/live/blog_live.html.leex new file mode 100644 index 0000000..0a88320 --- /dev/null +++ b/apps/web/lib/web/live/blog_live.html.leex @@ -0,0 +1,30 @@ + +
+
+
+

Felipe Lincoln

+

Hi, I am lorem ipsum dolor sit amet consectetur adipiscing elit.

+
+ @felipelincoln + /felipelincoln +
+
+ +
+ +
+ <%= for a <- @articles do %> +
+

<%= a.date %>

+

<%= a.title %>

+
+ <%= raw a.body_html %> + Read more +
+ <% end %> +
+
+ diff --git a/apps/web/lib/web/router.ex b/apps/web/lib/web/router.ex index 7c6875c..8074e40 100644 --- a/apps/web/lib/web/router.ex +++ b/apps/web/lib/web/router.ex @@ -12,6 +12,7 @@ defmodule Web.Router do pipe_through :browser live "/", HomeLive + live "/:username", BlogLive live "/:username/:article", ArticleLive end end From 85d651cdb8f3f04271a42660f995b44d18128abd Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 13 Mar 2021 10:39:09 -0300 Subject: [PATCH 05/52] add new article page --- apps/web/lib/web/live/blog_live.ex | 9 +++++++ apps/web/lib/web/live/new_live.ex | 33 ++++++++++++++++++++++++ apps/web/lib/web/live/new_live.html.leex | 16 ++++++++++++ apps/web/lib/web/router.ex | 1 + 4 files changed, 59 insertions(+) create mode 100644 apps/web/lib/web/live/new_live.ex create mode 100644 apps/web/lib/web/live/new_live.html.leex diff --git a/apps/web/lib/web/live/blog_live.ex b/apps/web/lib/web/live/blog_live.ex index 7ec54f2..6c3edc8 100644 --- a/apps/web/lib/web/live/blog_live.ex +++ b/apps/web/lib/web/live/blog_live.ex @@ -19,6 +19,15 @@ defmodule Web.BlogLive do

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

""" + }, + %{ + title: "Consectetur adipiscing elit.", + date: Timex.today() |> Timex.format!("%b %e", :strftime), + body_html: """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+ """ } ] diff --git a/apps/web/lib/web/live/new_live.ex b/apps/web/lib/web/live/new_live.ex new file mode 100644 index 0000000..5df3318 --- /dev/null +++ b/apps/web/lib/web/live/new_live.ex @@ -0,0 +1,33 @@ +defmodule Web.NewLive do + use Phoenix.LiveView + import Phoenix.HTML, only: [raw: 1] + + @meta %{ + title: "branchpage title", + description: "some description", + social_image: "/images/cover.png" + } + + @impl true + def mount(_params, _session, socket) do + date = Timex.today() |> Timex.format!("%b %e", :strftime) + title = "Lorem ipsum dolor sit amet. Consectetur adipiscing elit." + + body_html = """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+

Suspendisse semper diam sit amet enim placerat, nec suscipit dolor efficitur. Suspendisse nec erat vitae felis dignissim rhoncus porta sit amet ipsum. Quisque consequat leo nec est hendrerit aliquet. Donec accumsan sem ut sapien placerat facilisis. Sed pharetra efficitur mi, quis condimentum ipsum egestas quis. Duis ultrices, nibh ut placerat tincidunt, elit dolor tincidunt orci, id ornare metus urna accumsan ex. Duis quis ullamcorper ex, blandit sagittis metus. Quisque urna mi, condimentum quis tortor non, maximus maximus felis. Suspendisse accumsan augue purus, ut pharetra nunc congue at.

+

Fusce sit amet euismod arcu. In hac habitasse platea dictumst. Morbi non ullamcorper turpis. Curabitur rutrum venenatis nisl, sit amet pharetra erat rhoncus non. Suspendisse et arcu vitae eros bibendum porta convallis vel dolor. Maecenas eget sodales ex. Vestibulum feugiat purus vitae risus ultrices, sed vehicula justo posuere. Nulla commodo, elit sed tincidunt facilisis, nunc nunc posuere ligula, bibendum auctor mi ante et augue. Pellentesque finibus facilisis ex, eget volutpat turpis aliquet ac. Nullam lectus erat, finibus sed purus eu, maximus commodo enim. Curabitur tincidunt justo nec justo laoreet sodales vitae a nibh.

+ """ + + socket = + socket + |> assign(@meta) + |> assign(:date, date) + |> assign(:title, title) + |> assign(:body_html, body_html) + + {:ok, socket} + end +end diff --git a/apps/web/lib/web/live/new_live.html.leex b/apps/web/lib/web/live/new_live.html.leex new file mode 100644 index 0000000..00f60c9 --- /dev/null +++ b/apps/web/lib/web/live/new_live.html.leex @@ -0,0 +1,16 @@ + +
+
+ +
+
+

<%= @date %>

+

<%= @title %>

+
+ <%= raw @body_html %> +
+
+ diff --git a/apps/web/lib/web/router.ex b/apps/web/lib/web/router.ex index 8074e40..b4bb0d7 100644 --- a/apps/web/lib/web/router.ex +++ b/apps/web/lib/web/router.ex @@ -12,6 +12,7 @@ defmodule Web.Router do pipe_through :browser live "/", HomeLive + live "/new", NewLive live "/:username", BlogLive live "/:username/:article", ArticleLive end From d48341560729f6ad3ac51154589e136375e5447d Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 13 Mar 2021 10:45:39 -0300 Subject: [PATCH 06/52] add search page --- apps/web/lib/web/live/search_live.ex | 44 +++++++++++++++++++++ apps/web/lib/web/live/search_live.html.leex | 22 +++++++++++ apps/web/lib/web/router.ex | 1 + 3 files changed, 67 insertions(+) create mode 100644 apps/web/lib/web/live/search_live.ex create mode 100644 apps/web/lib/web/live/search_live.html.leex diff --git a/apps/web/lib/web/live/search_live.ex b/apps/web/lib/web/live/search_live.ex new file mode 100644 index 0000000..8ea3d51 --- /dev/null +++ b/apps/web/lib/web/live/search_live.ex @@ -0,0 +1,44 @@ +defmodule Web.SearchLive do + use Phoenix.LiveView + import Phoenix.HTML, only: [raw: 1] + + @meta %{ + title: "branchpage title", + description: "some description", + social_image: "/images/cover.png" + } + + @impl true + def mount(params, _session, socket) do + q = Map.get(params, "q") + + articles = [ + %{ + title: "Lorem ipsum dolor sit amet. Consectetur adipiscing elit.", + date: Timex.today() |> Timex.format!("%b %e", :strftime), + body_html: """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+ """ + }, + %{ + title: "Consectetur adipiscing elit.", + date: Timex.today() |> Timex.format!("%b %e", :strftime), + body_html: """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+ """ + } + ] + + socket = + socket + |> assign(@meta) + |> assign(:q, q) + |> assign(:articles, articles) + + {:ok, socket} + end +end diff --git a/apps/web/lib/web/live/search_live.html.leex b/apps/web/lib/web/live/search_live.html.leex new file mode 100644 index 0000000..91cfe2c --- /dev/null +++ b/apps/web/lib/web/live/search_live.html.leex @@ -0,0 +1,22 @@ + +
+
+ +
+
+ <%= for a <- @articles do %> +
+

<%= a.date %>

+

<%= a.title %>

+
+ <%= raw a.body_html %> + Read more +
+ <% end %> +
+
+ + diff --git a/apps/web/lib/web/router.ex b/apps/web/lib/web/router.ex index b4bb0d7..f2b0837 100644 --- a/apps/web/lib/web/router.ex +++ b/apps/web/lib/web/router.ex @@ -13,6 +13,7 @@ defmodule Web.Router do live "/", HomeLive live "/new", NewLive + live "/search", SearchLive live "/:username", BlogLive live "/:username/:article", ArticleLive end From 7141dbde753d6b1f83658f1553b841459550a516 Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 13 Mar 2021 11:18:25 -0300 Subject: [PATCH 07/52] add error page --- apps/web/lib/web/view/error_view.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/lib/web/view/error_view.ex b/apps/web/lib/web/view/error_view.ex index f5d412f..6dab20c 100644 --- a/apps/web/lib/web/view/error_view.ex +++ b/apps/web/lib/web/view/error_view.ex @@ -42,8 +42,13 @@ defmodule Web.ErrorView do - apps/web/lib/web/view/error_view.ex -

<%= @description %>

+ +
+ 404! +
""" From 01b62ebc57791456fd73735807958a709788f940 Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 20 Mar 2021 17:57:29 -0300 Subject: [PATCH 08/52] update home page --- apps/web/lib/web/live/home_live.ex | 34 +++++++++++++++++------ apps/web/lib/web/live/home_live.html.leex | 23 +++++++++++++-- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/apps/web/lib/web/live/home_live.ex b/apps/web/lib/web/live/home_live.ex index cfb603d..095cd59 100644 --- a/apps/web/lib/web/live/home_live.ex +++ b/apps/web/lib/web/live/home_live.ex @@ -1,5 +1,6 @@ defmodule Web.HomeLive do use Phoenix.LiveView + import Phoenix.HTML, only: [raw: 1] @meta %{ title: "branchpage title", @@ -8,18 +9,35 @@ defmodule Web.HomeLive do } @impl true - def mount(_params, _session, socket) do + def mount(params, _session, socket) do + q = Map.get(params, "q") + + articles = [ + %{ + title: "Lorem ipsum dolor sit amet. Consectetur adipiscing elit.", + date: Timex.today() |> Timex.format!("%b %e", :strftime), + body_html: """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+ """ + }, + %{ + title: "Consectetur adipiscing elit.", + date: Timex.today() |> Timex.format!("%b %e", :strftime), + body_html: """ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare eu mi eget lacinia. Maecenas tincidunt risus vel mi vehicula, sit amet varius ligula porta. Pellentesque id ex viverra, pellentesque neque eget, aliquet magna. Sed viverra egestas pulvinar. Mauris luctus egestas ante, et facilisis ligula vulputate sit amet. Nunc ut ipsum velit. Vivamus finibus scelerisque nibh, ac dapibus mauris finibus ut. Sed consequat nibh at pharetra ornare.

+

Vivamus nunc dui, pellentesque quis nulla vel, laoreet facilisis sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis libero nibh, varius ac lacus nec, gravida facilisis mi. Mauris urna libero, laoreet sit amet gravida ac, pharetra eu magna. Morbi iaculis egestas interdum. Donec a mi sit amet ipsum consequat malesuada. Nam magna erat, tempus eget tortor nec, fringilla tincidunt odio. Mauris finibus eget mi vitae aliquet. Maecenas a est vitae urna vestibulum vulputate id at urna. Donec id feugiat orci, vel tincidunt nunc. Quisque dapibus libero porta fringilla consectetur.

+

Aenean nunc augue, bibendum vitae aliquet sed, rhoncus at mauris. Morbi eleifend ultrices commodo. Donec bibendum justo a ultricies vehicula. Sed iaculis enim et nisl auctor, nec ultricies tortor suscipit. Phasellus non convallis dui. Nullam scelerisque quis tortor nec sollicitudin. Pellentesque tristique pretium nunc a tincidunt. Fusce sodales nunc sapien, at scelerisque diam fermentum sit amet. Fusce eu arcu magna. Curabitur ullamcorper elementum nisi vitae efficitur. Curabitur in venenatis magna. Fusce suscipit ex lectus, at iaculis est efficitur nec. Cras vitae dolor placerat, placerat sapien sit amet, tempor magna. Fusce sagittis leo sit amet magna venenatis fringilla. Phasellus euismod purus ex, quis egestas odio elementum sed.

+ """ + } + ] + socket = socket |> assign(@meta) - |> assign(:value, 0) + |> assign(:articles, articles) {:ok, socket} end - - @impl true - def handle_event("increase", _value, socket) do - value = socket.assigns.value - {:noreply, assign(socket, :value, value + 1)} - end end diff --git a/apps/web/lib/web/live/home_live.html.leex b/apps/web/lib/web/live/home_live.html.leex index 4b7411d..2673a03 100644 --- a/apps/web/lib/web/live/home_live.html.leex +++ b/apps/web/lib/web/live/home_live.html.leex @@ -1,2 +1,21 @@ - -

<%= @value %>

+ +
+
+ <%= for a <- @articles do %> +
+

<%= a.date %>

+

<%= a.title %>

+
+ <%= raw a.body_html %> + Read more +
+ <% end %> +
+
From 7b26335a096392197b5768163975c89a200bb9b9 Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 20 Mar 2021 18:52:13 -0300 Subject: [PATCH 09/52] remove params var --- apps/web/lib/web/live/home_live.ex | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/web/lib/web/live/home_live.ex b/apps/web/lib/web/live/home_live.ex index 095cd59..6c69f77 100644 --- a/apps/web/lib/web/live/home_live.ex +++ b/apps/web/lib/web/live/home_live.ex @@ -9,9 +9,7 @@ defmodule Web.HomeLive do } @impl true - def mount(params, _session, socket) do - q = Map.get(params, "q") - + def mount(_params, _session, socket) do articles = [ %{ title: "Lorem ipsum dolor sit amet. Consectetur adipiscing elit.", From 96a6aa63fe7ee94dae130ecb2ecca909a806dd13 Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sat, 20 Mar 2021 19:29:35 -0300 Subject: [PATCH 10/52] adjust font family and size --- apps/web/assets/css/base.css | 4 ++++ apps/web/assets/tailwind.config.js | 3 +++ apps/web/lib/web/live/article_live.html.leex | 6 +++--- apps/web/lib/web/templates/layout/base.html.eex | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/web/assets/css/base.css b/apps/web/assets/css/base.css index b5c61c9..111e7bc 100644 --- a/apps/web/assets/css/base.css +++ b/apps/web/assets/css/base.css @@ -1,3 +1,7 @@ @tailwind base; @tailwind components; @tailwind utilities; + +html { + font-size: 1.125rem +} diff --git a/apps/web/assets/tailwind.config.js b/apps/web/assets/tailwind.config.js index ab0bfdc..9f3bb42 100644 --- a/apps/web/assets/tailwind.config.js +++ b/apps/web/assets/tailwind.config.js @@ -13,6 +13,9 @@ module.exports = { screens: { 'sm': '680px' }, + fontFamily: { + 'sans': '"Lato", "Helvetica Neue", Helvetica, Arial, sans-serif' + }, }, }, variants: { diff --git a/apps/web/lib/web/live/article_live.html.leex b/apps/web/lib/web/live/article_live.html.leex index 9c81610..c47d7be 100644 --- a/apps/web/lib/web/live/article_live.html.leex +++ b/apps/web/lib/web/live/article_live.html.leex @@ -1,12 +1,12 @@ - -
+ +

<%= @date %>

<%= @title %>

-
<%= raw @body_html %>
+
<%= raw @body_html %>
-
-
- <%= for article <- @next_articles do %> -

<%= article.title %>

- <% end %> -
diff --git a/apps/web/lib/web/templates/layout/base.html.eex b/apps/web/lib/web/templates/layout/base.html.eex index d393658..aad66d2 100644 --- a/apps/web/lib/web/templates/layout/base.html.eex +++ b/apps/web/lib/web/templates/layout/base.html.eex @@ -44,5 +44,8 @@ <%= @inner_content %> + From 9173620c89720e86939855c118274e7e86fd7ffb Mon Sep 17 00:00:00 2001 From: Felipe LIncoln Date: Sun, 21 Mar 2021 16:12:48 -0300 Subject: [PATCH 15/52] add resposive paddings --- apps/web/lib/web/live/article_live.html.leex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/lib/web/live/article_live.html.leex b/apps/web/lib/web/live/article_live.html.leex index 4e49676..c0cce2f 100644 --- a/apps/web/lib/web/live/article_live.html.leex +++ b/apps/web/lib/web/live/article_live.html.leex @@ -1,4 +1,4 @@ -