@@ -2,42 +2,174 @@ import type {ReactNode} from 'react';
22import clsx from 'clsx' ;
33import Link from '@docusaurus/Link' ;
44import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
5+ import useBaseUrl from '@docusaurus/useBaseUrl' ;
56import Layout from '@theme/Layout' ;
67import HomepageFeatures from '@site/src/components/HomepageFeatures' ;
78import Heading from '@theme/Heading' ;
89
910import styles from './index.module.css' ;
1011
11- function HomepageHeader ( ) {
12- const { siteConfig} = useDocusaurusContext ( ) ;
12+ function HeroBanner ( ) {
13+ return (
14+ < div className = { styles . hero } data-theme = "dark" >
15+ < div className = { styles . heroInner } >
16+ < Heading as = "h1" className = { styles . heroProjectTagline } >
17+ < img
18+ alt = "Context-Generic Programming"
19+ className = { styles . heroLogo }
20+ src = { useBaseUrl ( '/img/docusaurus.png' ) }
21+ width = "200"
22+ height = "200"
23+ />
24+ < span className = { styles . heroTitleTextHtml } >
25+ Build < b > modular</ b > Rust applications with < b > zero-cost</ b > abstractions
26+ </ span >
27+ </ Heading >
28+ < div className = { styles . indexCtas } >
29+ < Link className = "button button--primary button--lg" to = "/docs" >
30+ Get Started
31+ </ Link >
32+ < Link
33+ className = "button button--secondary button--lg margin-left--md"
34+ to = "/docs/tutorials/hello" >
35+ Tutorial - 10 min ⏱️
36+ </ Link >
37+ < span className = { styles . indexCtasGitHubButtonWrapper } >
38+ < iframe
39+ className = { styles . indexCtasGitHubButton }
40+ src = "https://ghbtns.com/github-btn.html?user=contextgeneric&repo=cgp&type=star&count=true&size=large"
41+ width = { 160 }
42+ height = { 30 }
43+ title = "GitHub Stars"
44+ />
45+ </ span >
46+ </ div >
47+ </ div >
48+ </ div >
49+ ) ;
50+ }
51+
52+ function CodeExampleSection ( ) {
1353 return (
14- < header className = { clsx ( 'hero hero--primary' , styles . heroBanner ) } >
54+ < div className = { clsx ( styles . section , styles . sectionAlt ) } >
1555 < div className = "container" >
16- < Heading as = "h1" className = "hero__title" >
17- { siteConfig . title }
56+ < div className = "row" >
57+ < div className = "col col--6" >
58+ < Heading as = "h2" > Bypass Coherence Restrictions</ Heading >
59+ < p >
60+ CGP enables you to write < b > overlapping</ b > and < b > orphan</ b > implementations
61+ of any trait, breaking free from Rust's coherence rules while maintaining
62+ type safety.
63+ </ p >
64+ < p >
65+ Annotate any trait with < code > #[cgp_component]</ code > , write named implementations
66+ with < code > #[cgp_impl]</ code > , and selectively enable them using{ ' ' }
67+ < code > delegate_components!</ code > .
68+ </ p >
69+ </ div >
70+ < div className = "col col--6" >
71+ < div className = { styles . codeExample } >
72+ < pre >
73+ { `#[cgp_component(HashProvider)]
74+ pub trait Hash { ... }
75+
76+ #[cgp_impl(HashWithDisplay)]
77+ impl HashProvider
78+ where
79+ Self: Display,
80+ { ... }
81+
82+ delegate_components! {
83+ MyData {
84+ HashProviderComponent: HashWithDisplay,
85+ }
86+ }` }
87+ </ pre >
88+ </ div >
89+ </ div >
90+ </ div >
91+ </ div >
92+ </ div >
93+ ) ;
94+ }
95+
96+ function ProblemsSection ( ) {
97+ return (
98+ < div className = { styles . section } >
99+ < div className = "container" >
100+ < Heading as = "h2" className = "text--center margin-bottom--xl" >
101+ Common Rust Problems, Solved
18102 </ Heading >
19- < p className = "hero__subtitle" > { siteConfig . tagline } </ p >
103+ < div className = "row" >
104+ < div className = "col col--4" >
105+ < div className = { styles . problemCard } >
106+ < Heading as = "h3" > ⚡ No More Monolithic Traits</ Heading >
107+ < p >
108+ Break down large traits into small, focused components.
109+ Compose features without trait bounds propagating everywhere.
110+ </ p >
111+ </ div >
112+ </ div >
113+ < div className = "col col--4" >
114+ < div className = { styles . problemCard } >
115+ < Heading as = "h3" > 🔄 Overlapping Implementations</ Heading >
116+ < p >
117+ Implement traits in multiple ways without newtype wrappers.
118+ Choose the right implementation for your context.
119+ </ p >
120+ </ div >
121+ </ div >
122+ < div className = "col col--4" >
123+ < div className = { styles . problemCard } >
124+ < Heading as = "h3" > 🎯 Decouple Dependencies</ Heading >
125+ < p >
126+ Write core logic independent of error handling, async runtimes,
127+ or serialization libraries. Wire them up at the edges.
128+ </ p >
129+ </ div >
130+ </ div >
131+ </ div >
132+ </ div >
133+ </ div >
134+ ) ;
135+ }
136+
137+ function CallToActionSection ( ) {
138+ return (
139+ < div className = { clsx ( styles . section , styles . sectionAlt ) } >
140+ < div className = "container text--center" >
141+ < Heading as = "h2" > Ready to Get Started?</ Heading >
142+ < p className = "margin-bottom--lg" >
143+ CGP is in active development and perfect for early adopters who want to
144+ experiment with advanced Rust patterns.
145+ </ p >
20146 < div className = { styles . buttons } >
147+ < Link className = "button button--primary button--lg" to = "/docs" >
148+ Read the Docs
149+ </ Link >
21150 < Link
22- className = "button button--secondary button--lg"
23- to = "/docs/intro " >
24- Docusaurus Tutorial - 5min ⏱️
151+ className = "button button--secondary button--lg margin-left--md "
152+ to = "/docs/contribute " >
153+ Contribute to CGP
25154 </ Link >
26155 </ div >
27156 </ div >
28- </ header >
157+ </ div >
29158 ) ;
30159}
31160
32161export default function Home ( ) : ReactNode {
33162 const { siteConfig} = useDocusaurusContext ( ) ;
34163 return (
35164 < Layout
36- title = { `Home` }
37- description = "Context-Generic Programming (CGP) Project Homepage" >
38- < HomepageHeader />
165+ title = { siteConfig . tagline }
166+ description = "Context-Generic Programming (CGP) - A modular programming paradigm for Rust" >
39167 < main >
168+ < HeroBanner />
40169 < HomepageFeatures />
170+ < CodeExampleSection />
171+ < ProblemsSection />
172+ < CallToActionSection />
41173 </ main >
42174 </ Layout >
43175 ) ;
0 commit comments