Skip to content

Commit a4aaa3e

Browse files
ofriwclaude
andcommitted
Add codeComparison slide type for side-by-side code examples
Introduces new slide type specifically for comparing code snippets (e.g., ineffective vs effective prompts). Includes GPU-optimized rendering with proper syntax highlighting via RevealHighlight plugin. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent eb1e9b0 commit a4aaa3e

File tree

2 files changed

+73
-10
lines changed

2 files changed

+73
-10
lines changed

website/src/components/PresentationMode/RevealSlideshow.module.css

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/* GPU optimization for smooth slide transitions - shared utility */
2+
.gpuOptimized {
3+
will-change: transform;
4+
contain: layout paint;
5+
transform: translateZ(0);
6+
}
7+
18
.presentationOverlay {
29
position: fixed;
310
top: 0;
@@ -96,23 +103,43 @@
96103
}
97104

98105
.codeBlock {
106+
composes: gpuOptimized;
99107
font-size: 0.8em;
100108
line-height: 1.4;
101109
margin: 0;
102110
border-radius: 8px;
103111
background: #1e1e1e;
104-
padding: 1em;
112+
padding: 1.2em;
105113
text-align: left;
106-
overflow: auto;
114+
overflow-y: auto;
115+
overflow-x: auto;
107116
height: 100%;
108-
display: flex;
109-
align-items: center;
117+
white-space: pre;
110118
}
111119

112120
.codeBlock code {
113121
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
114122
}
115123

124+
.codeBlockSmall {
125+
composes: gpuOptimized;
126+
font-size: 0.65em;
127+
line-height: 1.3;
128+
margin: 0.5em 0 0 0;
129+
border-radius: 6px;
130+
background: #1e1e1e;
131+
padding: 1em;
132+
text-align: left;
133+
overflow-y: auto;
134+
overflow-x: auto;
135+
max-height: 400px;
136+
white-space: pre;
137+
}
138+
139+
.codeBlockSmall code {
140+
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
141+
}
142+
116143
.caption {
117144
font-size: clamp(0.8rem, 1.5vw, 0.95em);
118145
line-height: 1.4;
@@ -134,6 +161,7 @@
134161

135162
.comparisonLeft,
136163
.comparisonRight {
164+
composes: gpuOptimized;
137165
padding: clamp(0.7em, 1.5vw, 1em);
138166
border-radius: 8px;
139167
overflow-y: auto;
@@ -203,6 +231,7 @@
203231

204232
.metaphorColumn,
205233
.realityColumn {
234+
composes: gpuOptimized;
206235
padding: clamp(0.7em, 1.5vw, 1em);
207236
border-radius: 8px;
208237
overflow-y: auto;
@@ -301,6 +330,7 @@
301330

302331
/* Code Execution Flow Styles */
303332
.executionFlow {
333+
composes: gpuOptimized;
304334
text-align: left;
305335
max-width: 90%;
306336
margin: 0 auto;
@@ -496,7 +526,7 @@
496526
margin-left: auto;
497527
margin-right: auto;
498528
height: 100%;
499-
display: flex;
529+
display: flex !important;
500530
flex-direction: column;
501531
justify-content: flex-start;
502532
padding: 1em 0 2.5em 0;
@@ -527,15 +557,15 @@
527557
}
528558

529559
/* Caption area - fixed at bottom when present */
530-
.slideCaption {
560+
:global(.reveal) .slideCaption {
531561
margin-top: auto;
532-
margin-bottom: 0;
562+
margin-bottom: 2em;
533563
flex-shrink: 0;
534564
padding-top: 0.5em;
535565
padding-bottom: 0;
536566
}
537567

538-
:global(.reveal p),
568+
:global(.reveal p:not(.slideCaption)),
539569
:global(.reveal ul),
540570
:global(.reveal ol) {
541571
max-width: 90%;

website/src/components/PresentationMode/RevealSlideshow.tsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React, { useEffect, useRef } from 'react';
22
import Reveal from 'reveal.js';
3+
import RevealHighlight from 'reveal.js/plugin/highlight/highlight';
34
import 'reveal.js/dist/reveal.css';
45
import 'reveal.js/dist/theme/black.css';
6+
import 'reveal.js/plugin/highlight/monokai.css';
57
import styles from './RevealSlideshow.module.css';
68

79
// Import visual components that might be used in presentations
@@ -28,7 +30,7 @@ interface CodeExecutionStep {
2830
}
2931

3032
interface Slide {
31-
type: 'title' | 'concept' | 'code' | 'comparison' | 'visual' | 'takeaway' | 'marketingReality' | 'codeExecution';
33+
type: 'title' | 'concept' | 'code' | 'comparison' | 'codeComparison' | 'visual' | 'takeaway' | 'marketingReality' | 'codeExecution';
3234
title: string;
3335
subtitle?: string;
3436
content?: string[];
@@ -38,6 +40,8 @@ interface Slide {
3840
component?: string;
3941
left?: { label: string; content: string[] };
4042
right?: { label: string; content: string[] };
43+
leftCode?: { label: string; language: string; code: string };
44+
rightCode?: { label: string; language: string; code: string };
4145
metaphor?: { label: string; content: string[] };
4246
reality?: { label: string; content: string[] };
4347
steps?: CodeExecutionStep[];
@@ -102,7 +106,7 @@ export default function RevealSlideshow({ presentation, onClose }: RevealSlidesh
102106
loop: false,
103107

104108
// Plugins
105-
plugins: [],
109+
plugins: [RevealHighlight],
106110
});
107111

108112
deck.initialize().then(() => {
@@ -233,6 +237,35 @@ export default function RevealSlideshow({ presentation, onClose }: RevealSlidesh
233237
</section>
234238
);
235239

240+
case 'codeComparison':
241+
return (
242+
<section key={key} data-notes={formatSpeakerNotes(slide.speakerNotes)}>
243+
<h2>{slide.title}</h2>
244+
<div className={styles.comparison}>
245+
{slide.leftCode && (
246+
<div className={styles.comparisonLeft}>
247+
<h3 className={styles.ineffective}>{slide.leftCode.label}</h3>
248+
<pre className={styles.codeBlockSmall}>
249+
<code className={`language-${slide.leftCode.language || 'text'}`}>
250+
{slide.leftCode.code}
251+
</code>
252+
</pre>
253+
</div>
254+
)}
255+
{slide.rightCode && (
256+
<div className={styles.comparisonRight}>
257+
<h3 className={styles.effective}>{slide.rightCode.label}</h3>
258+
<pre className={styles.codeBlockSmall}>
259+
<code className={`language-${slide.rightCode.language || 'text'}`}>
260+
{slide.rightCode.code}
261+
</code>
262+
</pre>
263+
</div>
264+
)}
265+
</div>
266+
</section>
267+
);
268+
236269
case 'marketingReality':
237270
return (
238271
<section key={key} data-notes={formatSpeakerNotes(slide.speakerNotes)}>

0 commit comments

Comments
 (0)