because I got bored of customising my CV for every job
1import type React from "react";
2import { useState } from "react";
3
4/**
5 * Wrapper component for rendering stateful component examples in MDX
6 * Provides useState functionality for components that need state management
7 */
8export const ComponentExample = ({
9 children,
10 className,
11}: {
12 children: React.ReactNode;
13 className?: string;
14}) => {
15 return <div className={className}>{children}</div>;
16};
17
18/**
19 * Hook provider for component examples that need shared state
20 * Components should be available directly from MDX components scope
21 */
22export const ExampleStateProvider = <T,>({
23 children,
24 initialValue,
25}: {
26 children: (value: T, setValue: (value: T) => void) => React.ReactNode;
27 initialValue?: T;
28}) => {
29 const [value, setValue] = useState<T>(initialValue as T);
30 return <>{children(value, setValue)}</>;
31};