feat: create component to show current docs with specifics

This commit is contained in:
RadoslavDimchev 2023-10-24 17:28:09 +03:00
parent 3d3dfc8a2e
commit 5ab90a8f1d
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
import { useSelector } from 'react-redux'
import { DOCUMENTATIONS } from './documentations'
import { YStack } from 'tamagui'
import { Link } from 'react-router-dom'
import { Text } from '@status-im/components'
import { RootState } from '../../../../redux/store'
import SyntaxHighlighterBox from './SyntaxHighlighter'
type CurrentPlatformOSContentProps = {
selectedOS: string
}
const CurrentPlatformOSContent = ({ selectedOS }: CurrentPlatformOSContentProps) => {
const selectedClient = useSelector((state: RootState) => state.execClient.selectedClient)
return (
<YStack space={'$2'}>
{DOCUMENTATIONS[selectedClient].documentation[selectedOS].map((item, index) => {
switch (item.type) {
case 'code':
return <SyntaxHighlighterBox key={index} rows={[item.content]} />
case 'link':
return (
<Link key={index} to={item.to}>
{item.content}
</Link>
)
case 'text':
return (
<Text size={15} key={index}>
{item.content}
</Text>
)
default:
return null
}
})}
</YStack>
)
}
export default CurrentPlatformOSContent