UNPKG

1.87 kBTypeScriptView Raw
1/// <reference types="react" />
2import { RequireItResult } from './RsgRequireItResult';
3import { MarkdownExample, Example } from './RsgExample';
4import { LoaderComponent, ExpandMode, Component } from './RsgComponent';
5export interface BaseSection {
6 name?: string;
7 slug?: string;
8 ignore?: string | string[];
9 description?: string;
10 exampleMode?: ExpandMode;
11 usageMode?: ExpandMode;
12 href?: string;
13 sectionDepth?: number;
14 external?: boolean;
15 expand?: boolean;
16}
17export interface ProcessedSection extends BaseSection {
18 visibleName?: string;
19 filepath?: string;
20 externalLink?: boolean;
21 href?: string;
22}
23/**
24 * Section used on the client in javascript
25 * It is the output of the function `client/utils/processSection`
26 */
27export interface Section extends ProcessedSection {
28 content?: Example[] | string;
29 components?: Component[];
30 sections?: Section[];
31}
32/**
33 * Item of the Table Of Contents used in
34 * ComponentsList
35 * TableOfContent
36 * filterSectionByName
37 */
38export interface TOCItem extends ProcessedSection {
39 heading?: boolean;
40 shouldOpenInNewTab?: boolean;
41 selected?: boolean;
42 initialOpen?: boolean;
43 forcedOpen?: boolean;
44 content?: React.ReactNode;
45 components?: TOCItem[];
46 sections?: TOCItem[];
47}
48/**
49 * Used in the config file and at the early stages of processing
50 * in `schema/config.ts` this is the type that is used
51 */
52export interface ConfigSection extends BaseSection {
53 components?: string | string[] | (() => string[]);
54 sections?: ConfigSection[];
55 content?: string;
56}
57/**
58 * Type returned when sections are transformed to their webpack
59 * loadable equivalents
60 */
61export interface LoaderSection extends BaseSection {
62 slug?: string;
63 content?: RequireItResult | MarkdownExample;
64 components: LoaderComponent[];
65 sections: LoaderSection[];
66}
67
\No newline at end of file