Doc.tsx 818 B

1234567891011121314151617181920212223242526272829
  1. 'use client'
  2. import type { FC } from 'react'
  3. import { useContext } from 'use-context-selector'
  4. import TemplateEn from './template/template.en.mdx'
  5. import TemplateZh from './template/template.zh.mdx'
  6. import I18n from '@/context/i18n'
  7. import { LanguagesSupportedUnderscore, getModelRuntimeSupported } from '@/utils/language'
  8. type DocProps = {
  9. apiBaseUrl: string
  10. }
  11. const Doc: FC<DocProps> = ({
  12. apiBaseUrl,
  13. }) => {
  14. const { locale } = useContext(I18n)
  15. const language = getModelRuntimeSupported(locale)
  16. return (
  17. <article className='mx-1 px-4 sm:mx-12 pt-16 bg-white rounded-t-xl prose prose-xl'>
  18. {
  19. language !== LanguagesSupportedUnderscore[1]
  20. ? <TemplateEn apiBaseUrl={apiBaseUrl} />
  21. : <TemplateZh apiBaseUrl={apiBaseUrl} />
  22. }
  23. </article>
  24. )
  25. }
  26. export default Doc