import { useState, useEffect } from 'react';
import ReactMarkdown from 'react-markdown';
import Layout from '../components/layout/Layout';
export default function HowItWorksPage() {
const [content, setContent] = useState('');
const [loading, setLoading] = useState(true);
const [error, setError] = useState('');
useEffect(() => {
// Fetch markdown content
fetch('/content/how-it-works.md')
.then(response => {
if (!response.ok) {
throw new Error('Failed to load content');
}
return response.text();
})
.then(text => {
setContent(text);
setLoading(false);
})
.catch(err => {
console.error('Error loading how-it-works content:', err);
setError('Failed to load page content');
setLoading(false);
});
}, []);
if (loading) {
return (
);
}
if (error) {
return (
);
}
return (
{
const isInternal = href && href.startsWith('/');
if (isInternal) {
return (
{children}
);
}
return (
{children}
);
},
// Ensure images are responsive
img: ({ node, ...props }) => (
),
}}
>
{content}
);
}