1- import useDocusaurusContext from "@docusaurus/useDocusaurusContext " ;
1+ import BashSnippet from "@site/src/components/BashSnippet " ;
22import { LaunchIllustration } from "@site/src/icons/LaunchIllustration" ;
3- import { trackEvent } from "@site/src/providers/analytics.providers" ;
4- import CodeBlock from "@theme/CodeBlock" ;
5- import { useRef } from "react" ;
63import styles from "./styles.module.scss" ;
74
85export default function Launch ( ) : JSX . Element {
9- const { siteConfig } = useDocusaurusContext ( ) ;
10- const container = useRef ( null ) ;
11-
12- const onClick = async ( { target } : MouseEvent ) => {
13- const btn = container . current ?. querySelector ( 'button[title="Copy"]' ) ;
14-
15- if ( ! btn ?. contains ( target ) ) {
16- return ;
17- }
18-
19- await trackEvent ( {
20- name : "copy_launch_snippet" ,
21- siteConfig
22- } ) ;
23- } ;
24-
256 return (
267 < div className = { styles . sub } >
278 < article >
@@ -31,23 +12,10 @@ export default function Launch(): JSX.Element {
3112 templates.
3213 </ p >
3314
34- < div
35- className = { styles . code }
36- ref = { container }
37- onClick = { async ( $event ) => onClick ( $event as unknown as MouseEvent ) }
38- >
39- < svg
40- xmlns = "http://www.w3.org/2000/svg"
41- height = "24"
42- viewBox = "0 -960 960 960"
43- width = "24"
44- fill = "#00fff5"
45- className = { styles . bash }
46- >
47- < path d = "M530-481 353-658q-9-9-8.5-21t9.5-21q9-9 21.5-9t21.5 9l198 198q5 5 7 10t2 11q0 6-2 11t-7 10L396-261q-9 9-21 8.5t-21-9.5q-9-9-9-21.5t9-21.5l176-176Z" />
48- </ svg >
49- < CodeBlock className = "code-npm" > npm create juno@latest</ CodeBlock >
50- </ div >
15+ < BashSnippet
16+ analyticsEventName = "copy_launch_snippet"
17+ cmd = "npm create juno@latest"
18+ />
5119 </ article >
5220
5321 < picture
0 commit comments