Skip to content

Commit a23e5f1

Browse files
committed
language and command fixes
1 parent 3734b58 commit a23e5f1

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/components/Samples/index.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
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';
24
import Fuse, { FuseResult } from 'fuse.js';
35
import { Fragment, ReactNode, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react';
46
import ReactMarkdown from 'react-markdown';
5-
import { capitalCase } from 'change-case';
6-
import CodeBlock from '@theme/CodeBlock';
7-
import ExternalLink from '@theme/Icon/ExternalLink'
87

98

109
interface Sample {
@@ -24,6 +23,7 @@ interface SamplesProps {
2423
const categoryColors = {
2524
python: '#FFFFE0',
2625
nodejs: '#90EE90',
26+
typescript: '#cabbff',
2727
golang: '#b8e4f3',
2828
go: '#b8e4f3',
2929
sql: '#ebaef4',
@@ -146,14 +146,18 @@ export default function Samples() {
146146
<Box fontWeight="bold" component="span">
147147
{selectedSample.title}
148148
</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+
)}
157161
</Box>
158162
<Box sx={{ flexGrow: 1 }} />
159163
<Button sx={{
@@ -178,7 +182,7 @@ export default function Samples() {
178182
Clone and open the sample in your terminal
179183
</small>
180184
<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}"`}
182186
</CodeBlock>
183187
</Box>
184188
{/* </Stack> */}
@@ -220,7 +224,7 @@ export default function Samples() {
220224
const categoryMatched = matches.find((match) => match.key === 'category');
221225

222226
let shortDescription: ReactNode = sample.shortDescription.slice(0, 80);
223-
if(sample.shortDescription.length > 80) {
227+
if (sample.shortDescription.length > 80) {
224228
shortDescription += '...';
225229
}
226230
const shortDescriptionMatched = matches.find((match) => match.key === 'shortDescription');

0 commit comments

Comments
 (0)