Skip to content

Commit 84993fb

Browse files
committed
rewrite components doc generator
1 parent 5bc2709 commit 84993fb

37 files changed

+744
-641
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
build
22
lib
3-
node_modules
3+
/node_modules
44
coverage

fixtures/components/complex-types/table/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import * as React from 'react';
44
import { TableProps } from './interfaces';
55

6+
export { TableProps };
7+
68
export default function Table<T = any>(props: TableProps<T>) {
79
return <table />;
810
}

fixtures/components/error-incorrect-component-name/button/index.tsx renamed to fixtures/components/error-missing-props/button/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
import * as React from 'react';
44

5-
export default function Input() {
6-
return <span>Surprise, I am not Button!</span>;
5+
// should fail because ButtonProps export is missing
6+
export default function Button() {
7+
return <span>Test</span>;
78
}

fixtures/components/error-incorrect-component-name/tsconfig.json renamed to fixtures/components/error-missing-props/tsconfig.json

File renamed without changes.

fixtures/components/error-ref-property-type/button/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import * as React from 'react';
44

55
export namespace ButtonProps {
6-
interface Ref {
6+
export interface Ref {
77
value: string;
88
}
99
}
1010

11-
const Button = React.forwardRef((props, ref) => {
11+
const Button = React.forwardRef<ButtonProps.Ref>((props, ref) => {
1212
return <button />;
1313
});
1414

fixtures/components/forward-ref/focusable/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface FocusableProps {
99
children: React.ReactNode;
1010
}
1111

12-
export namespace SomethingElse {
12+
namespace SomethingElse {
1313
export interface Ref {
1414
/**
1515
* Should be ignored
@@ -29,6 +29,11 @@ export namespace FocusableProps {
2929
* Focuses element using the CSS-selector
3030
*/
3131
focusBySelector(selector: string): void;
32+
33+
/**
34+
* Showcase for optional functions
35+
*/
36+
cancelEdit?(): void;
3237
}
3338
}
3439

fixtures/components/import-types/dependency/index.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import * as React from 'react';
4+
import { DependencyProps } from './interfaces';
45

5-
export interface DependencyProps {
6-
name?: string;
7-
variant?: DependencyProps.Variant;
8-
}
9-
10-
// should not be included in the Main component API definition
11-
export interface MainProps {
12-
randomValue: string;
13-
}
14-
15-
export namespace DependencyProps {
16-
export type Variant = 'button' | 'link';
17-
}
6+
export { DependencyProps };
187

198
export default function Dependency({ name, variant = 'button' }: DependencyProps) {
209
return <div className={variant}>{name}</div>;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
export interface DependencyProps {
4+
name?: string;
5+
variant?: DependencyProps.Variant;
6+
}
7+
8+
// should not be included in the Main component API definition
9+
export interface MainProps {
10+
randomValue: string;
11+
}
12+
13+
export namespace DependencyProps {
14+
export type Variant = 'button' | 'link';
15+
}

fixtures/components/release-status/beta/index.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

fixtures/components/release-status/tsconfig.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)