Skip to content

feat: add recipe sidebar auto-block and layout#38

Merged
shsteimer merged 4 commits into
mainfrom
recipe-template
Oct 13, 2025
Merged

feat: add recipe sidebar auto-block and layout#38
shsteimer merged 4 commits into
mainfrom
recipe-template

Conversation

@shsteimer

Copy link
Copy Markdown
Collaborator

Summary

This PR implements the recipe sidebar auto-blocking feature as part of issue #5.

Changes

  • Recipe Template Eager Phase:

    • Set breadcrumb=recipe metadata if not already defined
    • Auto-create recipe-sidebar block in an aside element
    • Call buildAutoBlocks() function to handle auto-blocking logic
  • Recipe Template Lazy Phase:

    • Load all blocks in the aside element
  • Recipe Sidebar Block:

    • Loads content from /fragments/recipe-sidebar fragment
    • No custom styling needed (uses fragment content styles)
  • Layout:

    • Desktop (≥900px): CSS Grid layout with main and aside side by side
    • Main takes flexible space, aside is fixed 300px width with sticky positioning
    • Mobile: Sidebar is hidden
    • Header and footer span full width across both columns

Test Link

Preview: https://recipe-template--food-network--cloudadoption.aem.page/recipes/goulash-8670582

Part of

Part of #5

- Created recipe-ingredients block with checkbox functionality
- Each ingredient can be checked/unchecked to track preparation
- Checked ingredients get strikethrough styling
- Responsive design with clean, modern UI
- Fixed linting issues in recipe template files
- Red circular checkmarks (faded when unchecked, solid when checked)
- Select All/Deselect All toggle with dynamic label
- Three action buttons at bottom (Add to Shopping List, View Shopping List, Ingredient Substitutions)
- Add to Shopping List button disabled when nothing selected
- Custom icons for all buttons using CSS pseudo-elements
- Clean white background with proper borders
- Fully responsive design
- Set breadcrumb=recipe metadata in eager phase if not defined
- Auto-create recipe-sidebar block in aside element
- Load sidebar content from /fragments/recipe-sidebar
- Desktop layout uses CSS Grid with main and aside side by side
- Sidebar hidden on mobile, shown as sticky element on desktop (900px+)
- Header and footer span full width across both columns

Part of #5
@aem-code-sync

aem-code-sync Bot commented Oct 13, 2025

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@aem-code-sync

aem-code-sync Bot commented Oct 13, 2025

Copy link
Copy Markdown
Page Scores Audits Google
📱 /recipes/goulash-8670582 PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /recipes/goulash-8670582 PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@shsteimer
shsteimer merged commit 3416689 into main Oct 13, 2025
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 64 to +69
// eslint-disable-next-line no-unused-vars
export async function lazy(doc) {
// no operations
// Load blocks in the aside
const aside = doc.querySelector('aside');
if (aside) {
await loadSections(aside);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Target the correct sidebar in lazy loader

The lazy phase loads blocks for doc.querySelector('aside'), which simply returns the first <aside> in the document. If recipe content ever includes its own <aside> (for example inside the main article), this code will load that element instead of the auto‑inserted sidebar next to <main>, leaving the intended sidebar block unloaded and the layout showing an empty column. Consider selecting the sibling main.nextElementSibling or adding a distinguishing class when creating the sidebar so the lazy phase loads the right element.

Useful? React with 👍 / 👎.

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.

1 participant