Skip to content

Commit a90c684

Browse files
committed
[website] some adjustements
- adding NPM link in header - adding minimap in the demo - review order in api - review order of API in header & sidebar Also fix in graph-search a category for the NodeProp
1 parent 119144c commit a90c684

File tree

6 files changed

+55
-103
lines changed

6 files changed

+55
-103
lines changed

packages/graph-search/src/Edge.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import React, { FC, ReactNode, useMemo } from 'react';
44
import { Node, NodeProps } from './Node';
55
import { Labels } from './types';
66

7-
/**
8-
* Component that display an edge.
9-
*
10-
* @category Component
11-
*/
12-
export const Edge: FC<{
7+
interface EdgeProps {
138
source: NodeProps;
149
target: NodeProps;
1510
label?: ReactNode;
@@ -18,7 +13,14 @@ export const Edge: FC<{
1813
directed?: boolean;
1914
// Dynamic labels (for i18n for example)
2015
labels?: Labels;
21-
}> = ({ label, color, source, target, hidden, directed, labels = {} }) => {
16+
}
17+
18+
/**
19+
* Component that display an edge.
20+
*
21+
* @category Component
22+
*/
23+
export const Edge: FC<EdgeProps> = ({ label, color, source, target, hidden, directed, labels = {} }) => {
2224
return (
2325
<div className="edge">
2426
<Node {...source} labels={labels} />

packages/graph-search/src/Node.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ import React, { FC, ReactNode, useMemo } from 'react';
33

44
import { Labels } from './types';
55

6-
/**
7-
* Component that display a node.
8-
*
9-
* @category Component
10-
*/
116
export interface NodeProps {
127
label?: ReactNode;
138
color?: string;
149
hidden?: boolean;
1510
// Dynamic labels (for i18n for example)
1611
labels?: Labels;
1712
}
13+
14+
/**
15+
* Component that display a node.
16+
*
17+
* @category Component
18+
*/
1819
export const Node: FC<NodeProps> = ({ label, color, hidden, labels = {} }) => {
1920
return (
2021
<div className="node">
8.69 KB
Loading

packages/storybook/stories/Demo.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import '@react-sigma/core/lib/style.css';
33
import { GraphSearch, GraphSearchOption } from '@react-sigma/graph-search';
44
import '@react-sigma/graph-search/lib/style.css';
55
import { LayoutForceAtlas2Control } from '@react-sigma/layout-forceatlas2';
6+
import { MiniMap } from '@react-sigma/minimap';
67
import { NodeImageProgram } from '@sigma/node-image';
78
import Graph from 'graphology';
89
import { SerializedGraph } from 'graphology-types';
@@ -58,6 +59,9 @@ export const Demo: FC<{ style?: CSSProperties }> = ({ style }) => {
5859
<FullScreenControl />
5960
<LayoutForceAtlas2Control />
6061
</ControlsContainer>
62+
<ControlsContainer position={'bottom-left'}>
63+
<MiniMap width="100px" height="100px" />
64+
</ControlsContainer>
6165
<ControlsContainer position={'top-right'}>
6266
<GraphSearch
6367
type="nodes"

packages/website/docusaurus.config.ts

Lines changed: 31 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ const config: Config = {
4747
label: 'Getting Started',
4848
to: 'docs/start-introduction',
4949
},
50-
{
51-
label: 'API',
52-
to: 'docs/api/core',
53-
},
5450
{
5551
label: 'Example',
5652
to: 'docs/example/load-graph',
5753
},
54+
{
55+
label: 'Api',
56+
to: 'docs/api/core',
57+
},
5858
{
5959
type: 'doc',
6060
docId: 'changelog',
@@ -71,6 +71,11 @@ const config: Config = {
7171
label: 'GitHub',
7272
position: 'right',
7373
},
74+
{
75+
href: 'https://www.npmjs.com/org/react-sigma',
76+
label: 'NPM',
77+
position: 'right',
78+
},
7479
],
7580
},
7681
footer: {
@@ -147,12 +152,28 @@ const config: Config = {
147152
watch: false,
148153
out: 'docs/api/core',
149154
readme: 'none',
150-
sidebar: {
151-
categoryLabel: 'core',
152-
indexLabel: 'core',
153-
position: 0,
154-
fullNames: true,
155-
},
155+
},
156+
],
157+
[
158+
'docusaurus-plugin-typedoc',
159+
{
160+
id: 'graph-search',
161+
entryPoints: ['../graph-search/src/index.ts'],
162+
tsconfig: '../graph-search/tsconfig.json',
163+
watch: false,
164+
out: 'docs/api/graph-search',
165+
readme: 'none',
166+
},
167+
],
168+
[
169+
'docusaurus-plugin-typedoc',
170+
{
171+
id: 'minimap',
172+
entryPoints: ['../minimap/src/index.ts'],
173+
tsconfig: '../minimap/tsconfig.json',
174+
watch: false,
175+
out: 'docs/api/minimap',
176+
readme: 'none',
156177
},
157178
],
158179
[
@@ -164,12 +185,6 @@ const config: Config = {
164185
watch: false,
165186
out: 'docs/api/layout-core',
166187
readme: 'none',
167-
sidebar: {
168-
categoryLabel: 'layout-core',
169-
indexLabel: 'layout-core',
170-
position: 1,
171-
fullNames: true,
172-
},
173188
},
174189
],
175190
[
@@ -181,12 +196,6 @@ const config: Config = {
181196
watch: false,
182197
out: 'docs/api/layout-random',
183198
readme: 'none',
184-
sidebar: {
185-
categoryLabel: 'layout-random',
186-
indexLabel: 'layout-random',
187-
position: 2,
188-
fullNames: true,
189-
},
190199
},
191200
],
192201
[
@@ -198,12 +207,6 @@ const config: Config = {
198207
watch: false,
199208
out: 'docs/api/layout-circular',
200209
readme: 'none',
201-
sidebar: {
202-
categoryLabel: 'layout-circular',
203-
indexLabel: 'layout-circular',
204-
position: 3,
205-
fullNames: true,
206-
},
207210
},
208211
],
209212
[
@@ -215,12 +218,6 @@ const config: Config = {
215218
watch: false,
216219
out: 'docs/api/layout-circlepack',
217220
readme: 'none',
218-
sidebar: {
219-
categoryLabel: 'layout-circlepack',
220-
indexLabel: 'layout-circlepack',
221-
position: 4,
222-
fullNames: true,
223-
},
224221
},
225222
],
226223
[
@@ -232,12 +229,6 @@ const config: Config = {
232229
watch: false,
233230
out: 'docs/api/layout-forceatlas2',
234231
readme: 'none',
235-
sidebar: {
236-
categoryLabel: 'layout-forceatlas2',
237-
indexLabel: 'layout-forceatlas2',
238-
position: 5,
239-
fullNames: true,
240-
},
241232
},
242233
],
243234
[
@@ -249,12 +240,6 @@ const config: Config = {
249240
watch: false,
250241
out: 'docs/api/layout-force',
251242
readme: 'none',
252-
sidebar: {
253-
categoryLabel: 'layout-force',
254-
indexLabel: 'layout-force',
255-
position: 6,
256-
fullNames: true,
257-
},
258243
},
259244
],
260245
[
@@ -266,46 +251,6 @@ const config: Config = {
266251
watch: false,
267252
out: 'docs/api/layout-noverlap',
268253
readme: 'none',
269-
sidebar: {
270-
categoryLabel: 'layout-noverlap',
271-
indexLabel: 'layout-noverlap',
272-
position: 7,
273-
fullNames: true,
274-
},
275-
},
276-
],
277-
[
278-
'docusaurus-plugin-typedoc',
279-
{
280-
id: 'graph-search',
281-
entryPoints: ['../graph-search/src/index.ts'],
282-
tsconfig: '../graph-search/tsconfig.json',
283-
watch: false,
284-
out: 'docs/api/graph-search',
285-
readme: 'none',
286-
sidebar: {
287-
categoryLabel: 'graph-search',
288-
indexLabel: 'graph-search',
289-
position: 8,
290-
fullNames: true,
291-
},
292-
},
293-
],
294-
[
295-
'docusaurus-plugin-typedoc',
296-
{
297-
id: 'minimap',
298-
entryPoints: ['../minimap/src/index.ts'],
299-
tsconfig: '../minimap/tsconfig.json',
300-
watch: false,
301-
out: 'docs/api/minimap',
302-
readme: 'none',
303-
sidebar: {
304-
categoryLabel: 'minimap',
305-
indexLabel: 'graph-minimap',
306-
position: 9,
307-
fullNames: true,
308-
},
309254
},
310255
],
311256
function (_context, _options) {

packages/website/sidebars.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ module.exports = {
33
{ type: "category", label: "Getting started", items: ["start-introduction", "start-installation", "start-setup"] },
44
{
55
type: "category",
6-
label: "API",
6+
label: "Example",
77
items: [
8-
{ type: "doc", id: "api", label: "index" },
98
{
109
type: "autogenerated",
11-
dirName: "api",
10+
dirName: "example",
1211
},
1312
],
1413
},
1514
{
1615
type: "category",
17-
label: "Example",
16+
label: "API",
1817
items: [
18+
{ type: "doc", id: "api", label: "index" },
1919
{
2020
type: "autogenerated",
21-
dirName: "example",
21+
dirName: "api",
2222
},
2323
],
2424
},

0 commit comments

Comments
 (0)