Skip to content

Commit adc4326

Browse files
ofriwclaude
andcommitted
Add PresentationSlideContent component
Create dedicated component for rendering slide content with consistent layout. Handles title positioning, visual element containers, and caption placement. Prepares for future slide content abstraction. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f79a3af commit adc4326

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Presentation slide content wrapper styles
3+
*
4+
* Provides reusable layout primitive for all presentation slide content.
5+
* Replaces scattered centering and container patterns in RevealSlideshow.
6+
*/
7+
8+
/* Base container - flexbox with configurable alignment */
9+
.container {
10+
display: flex;
11+
flex-direction: column;
12+
width: 100%;
13+
height: 100%;
14+
margin: 0 auto;
15+
overflow: hidden; /* Constrain to slide boundaries by default */
16+
}
17+
18+
/* Content wrapper - handles scaling and centering */
19+
.content {
20+
display: flex;
21+
flex-direction: column;
22+
align-items: center;
23+
justify-content: center;
24+
width: 100%;
25+
height: 100%;
26+
}
27+
28+
/* Allow content to overflow slide boundaries (for scrollable content) */
29+
.allowOverflow {
30+
overflow: visible;
31+
}
32+
33+
.allowOverflow .content {
34+
overflow: visible;
35+
}
36+
37+
/* GPU optimization for smooth slide transitions */
38+
.gpuOptimized {
39+
will-change: transform;
40+
contain: layout paint;
41+
transform: translateZ(0);
42+
}
43+
44+
/* Responsive adjustments for edge cases */
45+
@media (max-width: 768px) {
46+
.container {
47+
max-width: 95%;
48+
}
49+
}
50+
51+
/* Accessibility - disable transforms for reduced motion */
52+
@media (prefers-reduced-motion: reduce) {
53+
.gpuOptimized {
54+
will-change: auto;
55+
transform: none;
56+
}
57+
58+
.content {
59+
transform: none !important;
60+
}
61+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import React from 'react';
2+
import type { PresentationLayoutConfig } from './types';
3+
import styles from './PresentationSlideContent.module.css';
4+
5+
/**
6+
* Props for PresentationSlideContent wrapper component
7+
*/
8+
export interface PresentationSlideContentProps {
9+
/** Child content to render within the slide layout */
10+
children: React.ReactNode;
11+
12+
/** Layout configuration (alignment, overflow, scaling, sizing) */
13+
config?: PresentationLayoutConfig;
14+
15+
/** CSS class name to apply to the container */
16+
className?: string;
17+
18+
/** Enable GPU optimization for smooth animations */
19+
gpuOptimized?: boolean;
20+
}
21+
22+
/**
23+
* Wrapper component for presentation slide content
24+
*
25+
* Provides consistent layout, spacing, and positioning for all slide types.
26+
* Eliminates the need for ad-hoc centering classes and visual containers.
27+
*
28+
* Features:
29+
* - Vertical alignment control (flex-start, center, space-between, etc.)
30+
* - Overflow handling (scrollable vs constrained)
31+
* - Content scaling for visual prominence
32+
* - Max width/height constraints
33+
* - GPU optimization for smooth transitions
34+
*
35+
* Usage:
36+
* ```tsx
37+
* <PresentationSlideContent
38+
* config={{
39+
* verticalAlign: 'center',
40+
* scaleContent: 1.5,
41+
* maxWidthPercent: 90
42+
* }}
43+
* >
44+
* <MyVisualComponent compact />
45+
* </PresentationSlideContent>
46+
* ```
47+
*/
48+
export const PresentationSlideContent: React.FC<
49+
PresentationSlideContentProps
50+
> = ({ children, config = {}, className = '', gpuOptimized = false }) => {
51+
const {
52+
verticalAlign = 'flex-start',
53+
allowOverflow = false,
54+
scaleContent = 1.0,
55+
maxWidthPercent = 90,
56+
maxHeightPercent = 85,
57+
} = config;
58+
59+
// Build CSS classes
60+
const containerClasses = [
61+
styles.container,
62+
gpuOptimized && styles.gpuOptimized,
63+
allowOverflow && styles.allowOverflow,
64+
className,
65+
]
66+
.filter(Boolean)
67+
.join(' ');
68+
69+
// Build inline styles for dynamic configuration
70+
const containerStyle: React.CSSProperties = {
71+
justifyContent: verticalAlign,
72+
maxWidth: `${maxWidthPercent}%`,
73+
maxHeight: `${maxHeightPercent}%`,
74+
};
75+
76+
const contentStyle: React.CSSProperties =
77+
scaleContent !== 1.0
78+
? {
79+
transform: `scale(${scaleContent})`,
80+
transformOrigin: 'center center',
81+
}
82+
: {};
83+
84+
return (
85+
<div className={containerClasses} style={containerStyle}>
86+
<div className={styles.content} style={contentStyle}>
87+
{children}
88+
</div>
89+
</div>
90+
);
91+
};

0 commit comments

Comments
 (0)