import React from 'react';
import { ContentBlock } from '../types';
import { TerminalBlock } from './TerminalBlock';
import { GitWorkflowDiagram } from './GitWorkflowDiagram';
import { AlertTriangle, Lightbulb, Info, CheckCircle2, ChevronDown } from 'lucide-react';
import gsap from 'gsap';
interface ContentRendererProps {
block: ContentBlock;
}
const Callout: React.FC<{ variant?: string; content: string }> = ({ variant = 'info', content }) => {
const getIcon = () => {
switch(variant) {
case 'warning': return ;
case 'tip': return ;
case 'success': return ;
default: return ;
}
};
const getStyles = () => {
switch(variant) {
case 'warning': return 'bg-destructive/10 border-destructive/20 text-destructive-foreground';
case 'tip': return 'bg-accent/10 border-accent/20 text-accent-foreground';
case 'success': return 'bg-primary/10 border-primary/20 text-primary-foreground';
default: return 'bg-blue-50 border-blue-200 text-blue-900';
}
};
// Adjusting styles to match new variables more closely for text colors where simple bg/text classes might fail due to variable usage
// The tailwind classes using vars (like text-primary) work if defined in config, which we did.
const getContainerClass = () => {
switch(variant) {
case 'warning': return 'bg-red-50 border-red-200 text-red-900';
case 'tip': return 'bg-amber-50 border-amber-200 text-amber-900';
case 'success': return 'bg-green-50 border-green-200 text-green-900';
default: return 'bg-blue-50 border-blue-200 text-blue-900';
}
}
return (
);
};
const Collapsible: React.FC<{ content: any, variant?: string }> = ({ content, variant }) => {
const [isOpen, setIsOpen] = React.useState(false);
const bodyRef = React.useRef(null);
const contentRef = React.useRef(null);
React.useEffect(() => {
if (!contentRef.current || !bodyRef.current) return;
if (isOpen) {
gsap.to(bodyRef.current, {
height: contentRef.current.scrollHeight,
duration: 0.4,
ease: "power2.out",
opacity: 1
});
} else {
gsap.to(bodyRef.current, {
height: 0,
duration: 0.3,
ease: "power2.in",
opacity: 0
});
}
}, [isOpen]);
const isPractice = variant === 'success';
return (
{Array.isArray(content.body) && content.body.map((subBlock: ContentBlock, idx: number) => (
))}
);
};
export const ContentRenderer: React.FC = ({ block }) => {
switch (block.type) {
case 'paragraph':
return {block.content as string}
;
case 'code':
return ;
case 'callout':
return ;
case 'list':
return (
{(block.content as string[]).map((item, i) => (
- {item}
))}
);
case 'ordered-list':
return (
{(block.content as string[]).map((item, i) => (
- {item}
))}
);
case 'subheading':
return
{block.content as string}
;
case 'collapsible':
return ;
case 'diagram':
return ;
default:
return null;
}
};