Browse Source

refactor & perf of files `datesets/Doc.tsx` and `template.xx.mdx` (#17951)

tags/1.3.0
yusheng chen 6 months ago
parent
commit
c9a594100b
No account linked to committer's email address

+ 13
- 11
web/app/(commonLayout)/datasets/Doc.tsx View File

'use client' 'use client'


import { useEffect, useState } from 'react'
import { useEffect, useMemo, useState } from 'react'
import { useContext } from 'use-context-selector' import { useContext } from 'use-context-selector'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { RiListUnordered } from '@remixicon/react' import { RiListUnordered } from '@remixicon/react'
} }
} }


const Template = useMemo(() => {
switch (locale) {
case LanguagesSupported[1]:
return <TemplateZh apiBaseUrl={apiBaseUrl} />
case LanguagesSupported[7]:
return <TemplateJa apiBaseUrl={apiBaseUrl} />
default:
return <TemplateEn apiBaseUrl={apiBaseUrl} />
}
}, [apiBaseUrl, locale])

return ( return (
<div className="flex"> <div className="flex">
<div className={`fixed right-20 top-32 z-10 transition-all ${isTocExpanded ? 'w-64' : 'w-10'}`}> <div className={`fixed right-20 top-32 z-10 transition-all ${isTocExpanded ? 'w-64' : 'w-10'}`}>
)} )}
</div> </div>
<article className='prose-xl prose mx-1 rounded-t-xl bg-white px-4 pt-16 sm:mx-12'> <article className='prose-xl prose mx-1 rounded-t-xl bg-white px-4 pt-16 sm:mx-12'>
{(() => {
switch (locale) {
case LanguagesSupported[1]:
return <TemplateZh apiBaseUrl={apiBaseUrl} />
case LanguagesSupported[7]:
return <TemplateJa apiBaseUrl={apiBaseUrl} />
default:
return <TemplateEn apiBaseUrl={apiBaseUrl} />
}
})()}
{Template}
</article> </article>
</div> </div>
) )

+ 5
- 0
web/app/(commonLayout)/datasets/template/template.en.mdx View File

{/**
* @typedef Props
* @property {string} apiBaseUrl
*/}

import { CodeGroup } from '@/app/components/develop/code.tsx' import { CodeGroup } from '@/app/components/develop/code.tsx'
import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx'



+ 5
- 0
web/app/(commonLayout)/datasets/template/template.ja.mdx View File

{/**
* @typedef Props
* @property {string} apiBaseUrl
*/}

import { CodeGroup } from '@/app/components/develop/code.tsx' import { CodeGroup } from '@/app/components/develop/code.tsx'
import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx'



+ 5
- 0
web/app/(commonLayout)/datasets/template/template.zh.mdx View File

{/**
* @typedef Props
* @property {string} apiBaseUrl
*/}

import { CodeGroup } from '@/app/components/develop/code.tsx' import { CodeGroup } from '@/app/components/develop/code.tsx'
import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx'



Loading…
Cancel
Save