Files
react/lib/components/attributes/attributes.tsx
witt 7facec3849 feat(scaleable): add scaleable props to each component (#531)
* feat(scaleable): add scaleable props to each component

* chore(scaleable): update the exported type

* feat: apply scaleable to components

chore: remove with-default

test: improve testcase for scaleable

chore: resolve test warning

ci: upgrade nodejs to latest lts

docs: fix type error in document site

* docs: update documents to be compatible with scaleable

chore: fix build errors

* chore: remove all size-related attributes

docs: improve guide document

* docs: add scaleable documentation

test: update snapshots

chore: remove unused

* feat: add scaleable to grid components

* docs: improve docs

* test: update snapshots

* fix(grid): fix basic component props
2021-08-13 17:10:57 +08:00

40 lines
1.1 KiB
TypeScript

import React from 'react'
import { Spacer } from 'components'
import VirtualAnchor from 'lib/components/anchor'
import { useConfigs } from '../../config-context'
import Contributors from './contributors'
import AttributesTitle from './attributes-title'
import AttributesTable from './attributes-table'
export interface AttributesProps {
edit: string
}
const Attributes: React.FC<React.PropsWithChildren<AttributesProps>> = React.memo(
({ edit, children }) => {
const { isChinese } = useConfigs()
const path = edit.replace('/pages', 'pages')
return (
<>
<Spacer h={5} />
<h3>
<VirtualAnchor>APIs</VirtualAnchor>
{isChinese && ' / 接口文档'}
</h3>
<AttributesTable>{children}</AttributesTable>
<Spacer h={3} />
<h4 className="contributor-title">{isChinese ? '文档贡献者' : 'Contributors'}</h4>
<Contributors path={path} />
</>
)
},
)
type AttributesComponent<P> = React.FC<P> & {
Title: typeof AttributesTitle
Table: typeof AttributesTable
}
export default Attributes as AttributesComponent<AttributesProps>