@@ -3,6 +3,12 @@ import { Card, CardContent } from "@/components/ui/card";
3
3
import { Code } from "@/components/ui/code" ;
4
4
import { Tabs , TabsContent , TabsList , TabsTrigger } from "@/components/ui/tabs" ;
5
5
6
+ import Prism from "prismjs" ;
7
+ import "prismjs/components/prism-jsx" ;
8
+ import "prismjs/components/prism-bash" ;
9
+
10
+ const usage_react_1 = `pnpm add @squircle-js/react` ;
11
+
6
12
const usage_react_2 = `
7
13
import { Squircle }
8
14
from "@squircle-js/react"
@@ -27,6 +33,24 @@ import { SquircleNoScript } from "@squircle-js/react";
27
33
...
28
34
` . trim ( ) ;
29
35
36
+ const highlightedUsage1 = Prism . highlight (
37
+ usage_react_1 ,
38
+ Prism . languages . bash ,
39
+ "bash"
40
+ ) ;
41
+
42
+ const highlightedUsage2 = Prism . highlight (
43
+ usage_react_2 ,
44
+ Prism . languages . jsx ,
45
+ "jsx"
46
+ ) ;
47
+
48
+ const highlightedUsage3 = Prism . highlight (
49
+ usage_react_3 ,
50
+ Prism . languages . jsx ,
51
+ "jsx"
52
+ ) ;
53
+
30
54
export const UsageSection = ( ) => {
31
55
return (
32
56
< div className = "mx-auto container w-full mb-36" >
@@ -47,30 +71,31 @@ export const UsageSection = () => {
47
71
Solid < Badge className = "ml-2 hidden sm:block" > soon</ Badge >
48
72
</ TabsTrigger >
49
73
</ TabsList >
74
+
50
75
< TabsContent value = "react" className = "w-fit mx-auto" >
51
76
< Card className = "w-full max-w-[480px] sm:max-w-[508px]" >
52
77
< CardContent className = "py-6 w-full" >
53
78
< h3 className = "font-semibold text-lg mb-2" >
54
79
Step 1.{ " " }
55
80
< span className = "font-normal" > Install the package.</ span >
56
81
</ h3 >
57
- < Code content = "pnpm add @squircle-js/react" />
82
+ < Code dangerousHTML = { highlightedUsage1 } raw = { usage_react_1 } />
58
83
59
84
< h3 className = "font-semibold text-lg mb-2 mt-4" >
60
85
Step 2.{ " " }
61
86
< span className = "font-normal" >
62
87
Import and use as a a regular div.
63
88
</ span >
64
89
</ h3 >
65
- < Code raw = { usage_react_2 } content = { < pre > { usage_react_2 } </ pre > } />
90
+ < Code raw = { usage_react_2 } dangerousHTML = { highlightedUsage2 } />
66
91
67
92
< h3 className = "font-semibold text-lg mb-2 mt-4" >
68
93
Step 3.{ " " }
69
94
< span className = "font-normal" >
70
- Add global component for noscript.
95
+ Add global component for noscript support .
71
96
</ span >
72
97
</ h3 >
73
- < Code raw = { usage_react_3 } content = { < pre > { usage_react_3 } </ pre > } />
98
+ < Code raw = { usage_react_3 } dangerousHTML = { highlightedUsage3 } />
74
99
</ CardContent >
75
100
</ Card >
76
101
</ TabsContent >
0 commit comments