mirror of
https://github.com/runyanjake/cooking.git
synced 2026-11-10 15:14:50 -08:00
PWS-11: Simplify Recipe Card tab and move it before References
Remove the print instructions and the Front/Back labels (page captions and card footer). Place the Recipe Card tab after Notes and before References, so References is always the last tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
parent
39c4b2fab0
commit
5d4515d9d5
@ -42,7 +42,7 @@ Markdown before the first section renders as intro prose above the tabs; markdow
|
||||
|
||||
### Recipe card (opt in)
|
||||
|
||||
- `::card` adds a Recipe Card tab with a printable 5×7 in PNG generated from `:::ingredients` and `:::instructions`
|
||||
- `::card` adds a Recipe Card tab with a printable 5×7 in PNG generated from `:::ingredients` and `:::instructions`. The tab always sits after Notes and before References, wherever the directive appears in the file
|
||||
- To give the card a shorter version, use the container form. The outer fence needs **four** colons; any section left out falls back to the full one:
|
||||
|
||||
```md
|
||||
|
||||
@ -65,22 +65,20 @@ export default async function RecipePage({ params }: RecipePageProps) {
|
||||
|
||||
const content = getRecipeContent(recipe);
|
||||
|
||||
const cardImages = await getRecipeCardImages(recipe);
|
||||
const cardTabs: RecipeTab[] = cardImages
|
||||
? [{ id: 'card', title: 'Recipe Card', content: <RecipeCardPanel title={recipe.title} images={cardImages} /> }]
|
||||
: [];
|
||||
|
||||
// The card goes right before References, which is always the last tab
|
||||
const tabs: RecipeTab[] = SECTION_NAMES.flatMap((name) => {
|
||||
const section = content.sections[name];
|
||||
return section
|
||||
const sectionTabs: RecipeTab[] = section
|
||||
? [{ id: name, title: SECTION_TITLES[name], content: <RecipeMarkdown content={section} recipe={recipe} /> }]
|
||||
: [];
|
||||
return name === 'references' ? [...cardTabs, ...sectionTabs] : sectionTabs;
|
||||
});
|
||||
|
||||
const cardImages = await getRecipeCardImages(recipe);
|
||||
if (cardImages) {
|
||||
tabs.push({
|
||||
id: 'card',
|
||||
title: 'Recipe Card',
|
||||
content: <RecipeCardPanel title={recipe.title} images={cardImages} />,
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<RecipePageLayout recipe={recipe}>
|
||||
<RecipeMarkdown content={content.intro} recipe={recipe} />
|
||||
|
||||
@ -14,11 +14,6 @@ export default function RecipeCardPanel({ title, images }: RecipeCardPanelProps)
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<p className="!mt-0 text-sm text-gray-600 dark:text-gray-400">
|
||||
A 5×7 in card at 300 DPI. Print it on 5×7 photo paper or card stock
|
||||
{doubleSided ? ', with the front and back on either side.' : '.'}
|
||||
</p>
|
||||
|
||||
<div className={doubleSided ? 'grid gap-6 xl:grid-cols-2' : ''}>
|
||||
{images.map((image) => (
|
||||
<figure key={image.fileName} className="!my-0">
|
||||
@ -30,7 +25,6 @@ export default function RecipeCardPanel({ title, images }: RecipeCardPanelProps)
|
||||
loading="lazy"
|
||||
className="h-auto w-full rounded-md border border-gray-200 dark:border-gray-700 bg-white shadow-sm"
|
||||
/>
|
||||
{doubleSided && <figcaption>{image.label}</figcaption>}
|
||||
</figure>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@ -456,7 +456,7 @@ function renderFace(recipe: Recipe, layout: CardLayout, face: CardFace): ReactEl
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex' }}>{pageUrl}</div>
|
||||
<div style={{ display: 'flex' }}>{face.name === 'card' ? SITE_NAME : `${SITE_NAME} · ${FACE_LABELS[face.name]}`}</div>
|
||||
<div style={{ display: 'flex' }}>{SITE_NAME}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -88,7 +88,7 @@ Markdown before the first section is intro prose; markdown after the last is out
|
||||
|
||||
#### Recipe Card (optional)
|
||||
|
||||
Add `::card` on its own line for a **Recipe Card** tab: a 5×7 in, 300 DPI PNG built from the ingredients and instructions, ready to download or print. Long recipes are split into a front and back automatically.
|
||||
Add `::card` on its own line for a **Recipe Card** tab: a 5×7 in, 300 DPI PNG built from the ingredients and instructions, ready to download or print. Long recipes are split into a front and back automatically. The tab always sits after Notes and before References, wherever `::card` appears in the file.
|
||||
|
||||
To put a shorter version on the card, use the container form with **four** colons. Leave out a section to use the full one:
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user