1
- import { Box , Button , Chip , Dialog , DialogActions , DialogContent , DialogTitle , Grid , List , ListItemButton , ListItemText , Stack , TextField } from '@mui/material' ;
1
+ import { Box , Button , Chip , Dialog , DialogActions , DialogContent , DialogTitle , List , ListItemButton , ListItemText , Stack , TextField } from '@mui/material' ;
2
+ import CodeBlock from '@theme/CodeBlock' ;
3
+ import ExternalLink from '@theme/Icon/ExternalLink' ;
2
4
import Fuse , { FuseResult } from 'fuse.js' ;
3
5
import { Fragment , ReactNode , useDeferredValue , useEffect , useMemo , useRef , useState } from 'react' ;
4
6
import ReactMarkdown from 'react-markdown' ;
5
- import { capitalCase } from 'change-case' ;
6
- import CodeBlock from '@theme/CodeBlock' ;
7
- import ExternalLink from '@theme/Icon/ExternalLink'
8
7
9
8
10
9
interface Sample {
@@ -24,6 +23,7 @@ interface SamplesProps {
24
23
const categoryColors = {
25
24
python : '#FFFFE0' ,
26
25
nodejs : '#90EE90' ,
26
+ typescript : '#cabbff' ,
27
27
golang : '#b8e4f3' ,
28
28
go : '#b8e4f3' ,
29
29
sql : '#ebaef4' ,
@@ -146,14 +146,18 @@ export default function Samples() {
146
146
< Box fontWeight = "bold" component = "span" >
147
147
{ selectedSample . title }
148
148
</ Box >
149
- < Chip
150
- label = { selectedSample . category }
151
- size = 'small'
152
- sx = { {
153
- backgroundColor : categoryColors [ selectedSample . category ] || categoryColors [ 'other' ] ,
154
- ml : 1 ,
155
- } }
156
- />
149
+ { ( selectedSample . languages ?. length ?? 0 ) > 0 && (
150
+ selectedSample . languages ?. map ( ( language ) => (
151
+ < Chip
152
+ label = { language }
153
+ size = 'small'
154
+ sx = { {
155
+ backgroundColor : categoryColors [ language ] || categoryColors [ 'other' ] ,
156
+ ml : 1 ,
157
+ } }
158
+ />
159
+ ) )
160
+ ) }
157
161
</ Box >
158
162
< Box sx = { { flexGrow : 1 } } />
159
163
< Button sx = { {
@@ -178,7 +182,7 @@ export default function Samples() {
178
182
Clone and open the sample in your terminal
179
183
</ small >
180
184
< CodeBlock language = "bash" >
181
- { `git clone https://github.com/DefangLabs/samples dtmp && cp -r dtmp/samples/${ selectedSample . name } "./${ selectedSample . name } " && rm -r ./dtmp && cd "${ selectedSample . name } "` }
185
+ { `git clone https://github.com/DefangLabs/samples dtmp && mv " dtmp/samples/${ selectedSample . name } " "./${ selectedSample . name } " && rm -rf ./dtmp && cd "./ ${ selectedSample . name } "` }
182
186
</ CodeBlock >
183
187
</ Box >
184
188
{ /* </Stack> */ }
@@ -220,7 +224,7 @@ export default function Samples() {
220
224
const categoryMatched = matches . find ( ( match ) => match . key === 'category' ) ;
221
225
222
226
let shortDescription : ReactNode = sample . shortDescription . slice ( 0 , 80 ) ;
223
- if ( sample . shortDescription . length > 80 ) {
227
+ if ( sample . shortDescription . length > 80 ) {
224
228
shortDescription += '...' ;
225
229
}
226
230
const shortDescriptionMatched = matches . find ( ( match ) => match . key === 'shortDescription' ) ;
0 commit comments