From 4bce5751f49efefe76db023f4629408720b4d2f3 Mon Sep 17 00:00:00 2001 From: Eduardo Borsa Date: Sat, 30 Dec 2023 17:46:29 -0300 Subject: [PATCH] Feat: Page-Builder-Featured-Pages-Component Signed-off-by: Eduardo Borsa --- lib/beacon_web/components/components.ex | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/lib/beacon_web/components/components.ex b/lib/beacon_web/components/components.ex index 2998b681b..0ff43bc2a 100644 --- a/lib/beacon_web/components/components.ex +++ b/lib/beacon_web/components/components.ex @@ -32,6 +32,80 @@ defmodule BeaconWeb.Components do """ end + @doc """ + Renders a feature page item to be used in the BeaconWeb.Components.featured_pages component. + + ## Examples + + + """ + + attr :title, :string, required: true + attr :published_date, :any, required: true + attr :image_path, :string, required: true + + def feature_page_item(assigns) do + ~H""" +
+
+

+ + <%= @title %> + +

+ +
+
+

+

+ +

+
+
+
+
+ Narwin +
+
+ """ + end + + @doc """ + + Renders a feature pages component. + + ## Examples + + + """ + + attr :site_pages, :list, default: [] + + def featured_pages(assigns) do + assigns = Map.put(assigns, :site_pages, Beacon.Content.list_pages(Process.get(:__beacon_site__), per_page: 3)) + + ~H""" +
+
+

+ Our Featured Blog Posts +

+

+ Recommended Reading +

+
+ +
+
+ +
+
+
+ """ + end + @doc """ Renders a image previously uploaded in Admin Media Library with srcset.