mirror of
https://github.com/zhigang1992/docz.git
synced 2026-04-30 11:02:56 +08:00
58 lines
1.1 KiB
TypeScript
58 lines
1.1 KiB
TypeScript
import { SFC, ReactNode, ComponentType } from 'react'
|
|
|
|
declare module 'playgrodd' {
|
|
export interface Section {
|
|
id: string
|
|
title?: string
|
|
render: () => ReactNode
|
|
}
|
|
|
|
export interface DocArgs {
|
|
name: string
|
|
}
|
|
|
|
export interface DocConstructorArgs {
|
|
name: string
|
|
}
|
|
|
|
export class Doc {
|
|
public id: string
|
|
public name: string
|
|
public sections: Section[]
|
|
public docDescription: string | null
|
|
public docRoute: string
|
|
public docOrder: number
|
|
|
|
public constructor({ name }: DocConstructorArgs)
|
|
|
|
public description(value: string): Doc
|
|
public section(...args: any[]): Doc
|
|
public route(value: string): Doc
|
|
public order(num: number): Doc
|
|
}
|
|
|
|
export interface DocMap {
|
|
[key: string]: Doc
|
|
}
|
|
|
|
export type Docs = Doc[]
|
|
|
|
/**
|
|
* Components
|
|
*/
|
|
|
|
export function createTheme(WrappedComponent: ComponentType): ComponentType
|
|
|
|
export interface PreviewProps {
|
|
children: (doc: Doc) => ReactNode
|
|
}
|
|
|
|
export const Preview: SFC<PreviewProps>
|
|
|
|
export interface DocsProps {
|
|
children: (docs: Doc[]) => ReactNode
|
|
}
|
|
|
|
export const Docs: SFC<DocsProps>
|
|
}
|