React context provider managing slide/deck state for presentations.
import { createContext, useContext, type ReactNode } from 'react';
import { useNavigation } from './useNavigation';
export interface Branding {
logoUrl?: string;
logoPlacement?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
footerText?: string;
footerPlacement?: 'top' | 'bottom';
}
export interface Fonts {
heading?: string;
body?: string;
}
interface DeckContextValue {
currentSlide: number;
slideCount: number;
direction: 1 | -1;
goTo: (index: number) => void;
next: () => void;
prev: () => void;
theme: string;
branding?: Branding;
fonts?: Fonts;
}
const DeckContext = createContext<DeckContextValue | null>(null);
export function useDeck() {
const ctx = useContext(DeckContext);
if (!ctx) throw new Error('useDeck must be used within
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key