Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Page Builder Featured Pages Component #389

Conversation

edborsa
Copy link
Contributor

@edborsa edborsa commented Dec 30, 2023

Issue: #357

@edborsa
Copy link
Contributor Author

edborsa commented Dec 30, 2023

Hey @leandrocp could you help me with something here?

I am not really sure what to do with @published_date and @@image_path.
From the list returned by Beacon.Content.list_pages the inserted_at is a DateTime and there is no image_path.
Another thing that I was not sure how to make it right is a missing part for the @site_pages. Is the attr attribute correct? How woul you do it?

@edborsa edborsa force-pushed the Issue-357-Page-Builder-Featured-Pages-Component branch from 4bce575 to 1f57bb1 Compare December 30, 2023 21:03
@leandrocp
Copy link
Contributor

@edborsa I just realized the issue isn't well described but you're still on the right path. Components are supposed to be reusable, and even though this one is extracted from dockyard.com, it still needs to be as generic as possible providing a default implementation that can be overwritten, thus we need to:

  1. let the user pass a function to fetch the pages (providing a default implementation)
  2. let the user define how such pages are displayed (providing a default implementation)

So the component call will look like this:

<BeaconWeb.Components.featured_pages />

Which should render a row with 3 pages displaying the page.title and page.updated_at, a link to page.path around each "card" and format the date as the image below:

featured pages

But the user may want to change which pages are displayed, so that component can accept a pages attr:

<BeaconWeb.Components.featured_pages pages={Beacon.Content.list_pages(@beacon.site, per_page: 3, query: "products", sort: :title)} />

Not only that but the user may want to customize how the pages are displayed as well:

<BeaconWeb.Components.featured_pages :let={page} pages={Beacon.Content.list_pages(...)}>
  <article ...>
    <%= page.title %>
  </article>
</BeaconWeb.Components.featured_pages>

Some notes:

  • There is no image, that's an extra attribute used solely in the dockyard.com site
  • Neither the header nor the footer has to be present in the component

I hope that's more clear now but feel free to ask. Thanks!

Signed-off-by: Eduardo Borsa <[email protected]>
@edborsa edborsa force-pushed the Issue-357-Page-Builder-Featured-Pages-Component branch 3 times, most recently from f5329f4 to bf014df Compare January 10, 2024 21:26
Signed-off-by: Eduardo Borsa <[email protected]>
@edborsa edborsa force-pushed the Issue-357-Page-Builder-Featured-Pages-Component branch from bf014df to 2404a86 Compare January 10, 2024 21:29
@edborsa edborsa force-pushed the Issue-357-Page-Builder-Featured-Pages-Component branch from 25b9bbc to 2e5f4db Compare January 10, 2024 23:54
@edborsa
Copy link
Contributor Author

edborsa commented Jan 10, 2024

@leandrocp I think I got it.
You can use with or without inner_content.

Without it will look like this:
image

@AZholtkevych AZholtkevych linked an issue Jan 11, 2024 that may be closed by this pull request
@leandrocp
Copy link
Contributor

❤️

@leandrocp leandrocp merged commit f45ef68 into BeaconCMS:main Jan 26, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Page Builder: Featured pages component
2 participants