diff --git a/src/client/components/CodeExample.tsx b/src/client/components/CodeExample.tsx new file mode 100644 index 0000000..f7dfd1b --- /dev/null +++ b/src/client/components/CodeExample.tsx @@ -0,0 +1,37 @@ +import React from 'react'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from './ui/tabs'; +import { CodeBlock } from './CodeBlock'; + +interface CodeExampleItem { + label: string; + code?: string; + element?: React.ReactNode; +} +interface CodeExampleProps { + className?: string; + example: Record; +} +export const CodeExample: React.FC = React.memo((props) => { + const keys = Object.keys(props.example); + + return ( + + + {keys.map((key) => ( + + {props.example[key].label} + + ))} + + + {keys.map((key) => ( + + {props.example[key].element ?? ( + + )} + + ))} + + ); +}); +CodeExample.displayName = 'CodeExample'; diff --git a/src/client/components/feed/FeedApiGuide.tsx b/src/client/components/feed/FeedApiGuide.tsx index f918654..a60b465 100644 --- a/src/client/components/feed/FeedApiGuide.tsx +++ b/src/client/components/feed/FeedApiGuide.tsx @@ -1,8 +1,7 @@ import { Card, CardContent, CardHeader } from '@/components/ui/card'; import React from 'react'; -import { CodeBlock } from '../CodeBlock'; import { useTranslation } from '@i18next-toolkit/react'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs'; +import { CodeExample } from '../CodeExample'; export const FeedApiGuide: React.FC<{ channelId: string }> = React.memo( (props) => { @@ -11,21 +10,21 @@ export const FeedApiGuide: React.FC<{ channelId: string }> = React.memo( return ( -
{t('You can send any message into this channel with:')}
+
{t('You can send a message to this channel with:')}
- - - curl - fetch - - - - - - - - +
{t('OR')}