Skip to content

Commit d97960e

Browse files
committed
website updates
1 parent 7fb8a50 commit d97960e

File tree

7 files changed

+92
-20
lines changed

7 files changed

+92
-20
lines changed

packages/website/src/components/ContentMissing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Callout } from 'nextra-theme-docs';
1+
import { Callout } from 'nextra/components';
22

33
export default function ContentMissing() {
44
return (

packages/website/src/pages/docs/getting-started/nodejs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ yarn add react-docgen
3232

3333
## Usage
3434

35-
Here is an easy example
35+
Here is a basic example
3636

3737
```ts filename="index.tsx" copy
3838
import { parse } from 'react-docgen';

packages/website/src/pages/docs/reference/documentation/basic.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Callout } from 'nextra-theme-docs';
1+
import { Callout } from 'nextra/components';
22

33
# Basic
44

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"child-context-type-handler": "childContextTypeHandler",
3-
"code-type-handler": "codeTypeHandler",
4-
"component-docblock-handler": "componentDocblockHandler",
5-
"component-methods-handler": "componentMethodsHandler",
6-
"context-type-handler": "contextTypeHandler",
7-
"default-props-handler": "defaultPropsHandler",
8-
"display-name-handler": "displayNameHandler",
9-
"prop-docblock-handler": "propDocblockHandler",
10-
"prop-type-composition-handler": "propTypeCompositionHandler",
11-
"prop-type-handler": "propTypeHandler"
2+
"child-context-type-handler": "childContextType",
3+
"code-type-handler": "codeType",
4+
"component-docblock-handler": "componentDocblock",
5+
"component-methods-handler": "componentMethods",
6+
"context-type-handler": "contextType",
7+
"default-props-handler": "defaultProps",
8+
"display-name-handler": "displayName",
9+
"prop-docblock-handler": "propDocblock",
10+
"prop-type-composition-handler": "propTypeComposition",
11+
"prop-type-handler": "propType"
1212
}
Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
1-
import ContentMissing from '@/components/ContentMissing';
2-
31
# propTypeCompositionHandler
42

5-
<ContentMissing />
3+
Adds the name of the module to the `composes` field when:
4+
5+
- a variable is spread into `propTypes`
6+
- the import cannot be followed
7+
8+
## Examples
9+
10+
When the `propTypeCompositionHandler` is active any of these components will
11+
result in the output below
12+
13+
```ts {1,6} filename="component.tsx"
14+
import otherPropTypes from './Link.js';
15+
import { Component } from 'react';
16+
17+
class Button extends Component {
18+
static propTypes = {
19+
...otherPropTypes,
20+
};
21+
22+
render() {
23+
return <div />;
24+
}
25+
}
26+
```
27+
28+
```ts {1,11} filename="component.tsx"
29+
import otherPropTypes from './Link.js';
30+
import { Component } from 'react';
31+
32+
class Button extends Component {
33+
render() {
34+
return <div />;
35+
}
36+
}
37+
38+
Button.propTypes = {
39+
...otherPropTypes,
40+
};
41+
```
42+
43+
```ts {1,6} filename="component.tsx"
44+
import otherPropTypes from './Link.js';
45+
46+
const Button = () => <div />;
47+
48+
Button.propTypes = {
49+
...otherPropTypes,
50+
};
51+
```
52+
53+
## Output
54+
55+
```json {3} filename="JSON"
56+
[
57+
{
58+
"composes": ["./Link.js"]
59+
}
60+
]
61+
```

packages/website/src/pages/index.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import { Callout } from 'nextra-theme-docs';
1+
import { Callout } from 'nextra/components';
22

3-
# react-docgen
3+
# Document React \<components /\> in JSON format
4+
5+
<br />
6+
<br />
47

58
`react-docgen` is a highly customizable library that extracts information from
69
[React](https://reactjs.org/) components and returns this information in a

packages/website/src/theme.config.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react';
22
import type { DocsThemeConfig } from 'nextra-theme-docs';
3+
import { useRouter } from 'next/router';
34

45
const config: DocsThemeConfig = {
5-
logo: <span>react-docgen</span>,
6+
logo: <span className="text-lg font-bold">react-docgen</span>,
67
project: {
78
link: 'https://github.com/reactjs/react-docgen',
89
},
@@ -11,7 +12,19 @@ const config: DocsThemeConfig = {
1112
footer: {
1213
text: '',
1314
},
14-
useNextSeoProps: () => ({ titleTemplate: '%s \u2013 react-docgen' }),
15+
useNextSeoProps: () => {
16+
const { asPath } = useRouter();
17+
18+
if (asPath !== '/') {
19+
return {
20+
titleTemplate: '%s \u2013 react-docgen',
21+
};
22+
} else {
23+
return {
24+
titleTemplate: 'react-docgen \u2013 React documentation generator',
25+
};
26+
}
27+
},
1528
};
1629

1730
export default config;

0 commit comments

Comments
 (0)