Doc.tsx 717 B

12345678910111213141516171819202122232425262728
  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 { LanguagesSupported } from '@/i18n/language'
  8. type DocProps = {
  9. apiBaseUrl: string
  10. }
  11. const Doc: FC<DocProps> = ({
  12. apiBaseUrl,
  13. }) => {
  14. const { locale } = useContext(I18n)
  15. return (
  16. <article className='mx-1 px-4 sm:mx-12 pt-16 bg-white rounded-t-xl prose prose-xl'>
  17. {
  18. locale !== LanguagesSupported[1]
  19. ? <TemplateEn apiBaseUrl={apiBaseUrl} />
  20. : <TemplateZh apiBaseUrl={apiBaseUrl} />
  21. }
  22. </article>
  23. )
  24. }
  25. export default Doc