1- import styles from './Hero.module.css' ;
21import { Button } from '@callstack/rspress-theme' ;
3- import { CodeBlockRuntime } from '@rspress/core/theme' ;
4- import { transformerNotationHighlight } from '@shikijs/transformers ' ;
2+ import { getCustomMDXComponent } from '@rspress/core/theme' ;
3+ import styles from './Hero.module.css ' ;
54
65export function Hero ( ) {
76 return (
@@ -17,44 +16,69 @@ export function Hero() {
1716 </ div >
1817
1918 < div className = { styles . featureList } >
20- < div className = { styles . feature } >
21- < h2 className = { styles . featureTitle } > Create</ h2 >
22- < p className = { styles . featureDescription } >
23- Scaffold a new React Native library with everything
24- pre-configured. Choose between templates such as Turbo Modules or
25- Nitro Modules.
26- </ p >
27- < div className = { styles . codeBlock } >
28- < CodeBlockRuntime
29- lang = "sh"
30- code = { `npx create-react-native-library@latest` }
31- shikiOptions = { {
32- transformers : [ transformerNotationHighlight ( ) ] ,
33- } }
34- />
35- </ div >
36- < Button href = "/react-native-builder-bob/create" > Learn more</ Button >
37- </ div >
38-
39- < div className = { styles . feature } >
40- < h2 className = { styles . featureTitle } > Build</ h2 >
41- < p className = { styles . featureDescription } >
42- Compile your React Native library to work with multiple tools.
43- Support Metro, Webpack, Vite, NodeJS & more with a single build .
44- </ p >
45- < div className = { styles . codeBlock } >
46- < CodeBlockRuntime
47- lang = "sh"
48- code = { `npx react-native-builder-bob@latest init` }
49- shikiOptions = { {
50- transformers : [ transformerNotationHighlight ( ) ] ,
51- } }
52- />
53- </ div >
54- < Button href = "/react-native-builder-bob/build" > Learn more</ Button >
55- </ div >
19+ < Feature
20+ title = "Create"
21+ description = "Scaffold a new React Native library with everything pre-configured. Choose between templates such as Turbo Modules or"
22+ code = { `npx create-react-native-library@latest` }
23+ link = "/react-native-builder-bob/create"
24+ />
25+ < Feature
26+ title = "Build"
27+ description = "Compile your React Native library to work with multiple tools. Support Metro, Webpack, Vite, NodeJS & more with a single build."
28+ code = { `npx react-native-builder-bob@latest init` }
29+ link = "/react-native-builder-bob/build"
30+ />
5631 </ div >
5732 </ div >
5833 </ div >
5934 ) ;
6035}
36+
37+ const { pre : Pre } = getCustomMDXComponent ( ) ;
38+
39+ function Feature ( {
40+ title,
41+ description,
42+ code,
43+ link,
44+ } : {
45+ title : string ;
46+ description : string ;
47+ code : string ;
48+ link : string ;
49+ } ) {
50+ return (
51+ < div className = { styles . feature } >
52+ < h2 className = { styles . featureTitle } > { title } </ h2 >
53+ < p className = { styles . featureDescription } > { description } </ p >
54+ < div className = { styles . codeBlock } >
55+ < Pre
56+ lang = "bash"
57+ className = "shiki css-variables"
58+ style = { {
59+ backgroundColor : 'var(--shiki-background)' ,
60+ color : 'var(--shiki-foreground)' ,
61+ } }
62+ >
63+ < code style = { { whiteSpace : 'pre' } } >
64+ { code . split ( ' ' ) . map ( ( part , index ) => {
65+ return (
66+ < span
67+ style = { {
68+ color :
69+ index === 0
70+ ? 'var(--shiki-token-function)'
71+ : 'var(--shiki-token-string)' ,
72+ } }
73+ >
74+ { part } { ' ' }
75+ </ span >
76+ ) ;
77+ } ) }
78+ </ code >
79+ </ Pre >
80+ </ div >
81+ < Button href = { link } > Learn more</ Button >
82+ </ div >
83+ ) ;
84+ }
0 commit comments