import { define } from '../../src' import { ButtonExamplesContent } from '../button' import { ProfileExamplesContent } from '../profile' import { NavigationExamplesContent } from '../navigation' export const Main = define('SpaMain', { base: 'div', minHeight: '100%', padding: '40px 20px', fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", background: '#f3f4f6', }) export const Container = define('SpaContainer', { base: 'div', maxWidth: 1200, margin: '0 auto' }) // Simple client-side router const Link = define('Link', { base: 'a', color: '#3b82f6', textDecoration: 'none', fontWeight: 500, states: { hover: { textDecoration: 'underline' } }, selectors: { '&[aria-current]': { color: '#1e40af', fontWeight: 600, textDecoration: 'underline' } }, render({ props, parts: { Root } }) { const handleClick = (e: Event) => { e.preventDefault() window.history.pushState({}, '', props.href) window.dispatchEvent(new Event('routechange')) } return ( {props.children} ) } }) const Nav = define('Nav', { base: 'nav', display: 'flex', gap: 20, marginBottom: 40, padding: 20, background: 'white', borderRadius: 8, boxShadow: '0 1px 3px rgba(0,0,0,0.1)' }) const P = define('P', { color: '#6b7280', fontSize: 18, marginBottom: 48, }) const ExamplesGrid = define('ExamplesGrid', { display: 'grid', gap: 20, gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))' }) const ExampleCard = define('ExampleCard', { base: 'a', background: 'white', padding: 24, borderRadius: 12, boxShadow: '0 1px 3px rgba(0,0,0,0.1)', textDecoration: 'none', transition: 'all 0.2s ease', display: 'block', states: { hover: { transform: 'translateY(-2px)', boxShadow: '0 4px 12px rgba(0,0,0,0.15)' } }, parts: { H2: { color: '#111827', margin: '0 0 8px 0', fontSize: 20, }, P: { color: '#6b7280', margin: 0, fontSize: 14, } }, render({ props: { title, desc, ...props }, parts: { Root, H2, P } }) { const handleClick = (e: Event) => { e.preventDefault() window.history.pushState({}, '', props.href) window.dispatchEvent(new Event('routechange')) } return (

{title}

{desc}

) } }) const HomePage = () => ( <>

Explore component examples built with Forge - Client-side SPA version

) const ProfilePage = () => const ButtonsPage = () => const NavigationPage = () => export function route(path: string) { switch (path) { case '/spa': case '/spa/': return case '/spa/profile': return case '/spa/buttons': return case '/spa/navigation': return default: return

404 Not Found

} } export function App() { const path = window.location.pathname return (
{route(path)}
) }