Skip to content

Commit c983218

Browse files
committed
Neutral mode for code comparison slide
1 parent 040c30c commit c983218

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

scripts/generate-presentation.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,21 @@ INCORRECT: Putting the better option on the left will show it with RED ✗ styli
590590
},
591591
"speakerNotes": { ... }
592592
},
593+
594+
CODE COMPARISON SLIDE (codeComparison):
595+
596+
Like regular comparison slides, codeComparison also supports the "neutral" flag:
597+
598+
1. EVALUATIVE (default, neutral=false or omitted):
599+
- LEFT side → RED background, RED heading (ineffective/worse code)
600+
- RIGHT side → GREEN background, GREEN heading (effective/better code)
601+
- Use when one code example is clearly inferior
602+
603+
2. NEUTRAL (neutral=true):
604+
- BOTH sides → PURPLE background, PURPLE heading (both valid approaches)
605+
- Use when comparing valid code alternatives with different trade-offs
606+
- Examples: "Imperative vs Functional", "Optimized for Speed vs Readability"
607+
593608
{
594609
"type": "codeComparison",
595610
"title": "Prompt Example: Ineffective vs Effective",
@@ -605,6 +620,22 @@ INCORRECT: Putting the better option on the left will show it with RED ✗ styli
605620
},
606621
"speakerNotes": { ... }
607622
},
623+
{
624+
"type": "codeComparison",
625+
"title": "Code Style Trade-offs: Imperative vs Functional",
626+
"neutral": true, // OPTIONAL: Use neutral=true for valid alternatives (PURPLE neutral styling)
627+
"leftCode": {
628+
"label": "Imperative Style", // Both styles valid - neutral styling
629+
"language": "javascript",
630+
"code": "const result = [];\nfor (let i = 0; i < items.length; i++) {\n if (items[i] > 10) {\n result.push(items[i] * 2);\n }\n}\nreturn result;"
631+
},
632+
"rightCode": {
633+
"label": "Functional Style", // Both styles valid - neutral styling
634+
"language": "javascript",
635+
"code": "return items\n .filter(x => x > 10)\n .map(x => x * 2);"
636+
},
637+
"speakerNotes": { ... }
638+
},
608639
{
609640
"type": "marketingReality",
610641
"title": "Marketing vs Reality: What Actually Happens",

website/src/components/PresentationMode/RevealSlideshow.tsx

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,18 @@ export default function RevealSlideshow({
312312
<h2>{slide.title}</h2>
313313
<div className={`${styles.comparison} ${styles.comparisonCode}`}>
314314
{slide.leftCode && (
315-
<div className={styles.comparisonLeft}>
316-
<h3 className={styles.ineffective}>{slide.leftCode.label}</h3>
315+
<div
316+
className={
317+
slide.neutral ? styles.neutralLeft : styles.comparisonLeft
318+
}
319+
>
320+
<h3
321+
className={
322+
slide.neutral ? styles.neutralHeading : styles.ineffective
323+
}
324+
>
325+
{slide.leftCode.label}
326+
</h3>
317327
<pre className={styles.codeBlockSmall}>
318328
<code
319329
className={`language-${slide.leftCode.language || 'text'}`}
@@ -324,8 +334,18 @@ export default function RevealSlideshow({
324334
</div>
325335
)}
326336
{slide.rightCode && (
327-
<div className={styles.comparisonRight}>
328-
<h3 className={styles.effective}>{slide.rightCode.label}</h3>
337+
<div
338+
className={
339+
slide.neutral ? styles.neutralRight : styles.comparisonRight
340+
}
341+
>
342+
<h3
343+
className={
344+
slide.neutral ? styles.neutralHeading : styles.effective
345+
}
346+
>
347+
{slide.rightCode.label}
348+
</h3>
329349
<pre className={styles.codeBlockSmall}>
330350
<code
331351
className={`language-${slide.rightCode.language || 'text'}`}

0 commit comments

Comments
 (0)