Skip to content

Commit d670b3e

Browse files
committed
website: rework tools sidebar
1 parent 2940ba1 commit d670b3e

File tree

7 files changed

+173
-305
lines changed

7 files changed

+173
-305
lines changed

website/docusaurus.config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import {fileURLToPath} from 'node:url';
1515
import path from 'node:path';
1616
import fs from 'node:fs';
1717

18-
19-
import addToolsToSidebar from './src/libs/addToolsToSidebar';
20-
21-
2218
// ----------------------------------------------------------------------------
2319

2420
function getCustomFields() {
@@ -87,10 +83,6 @@ function getCustomFields() {
8783
const customFields = getCustomFields();
8884
logger.info(customFields);
8985

90-
91-
addToolsToSidebar();
92-
93-
9486
// ----------------------------------------------------------------------------
9587

9688
const config: Config = {

website/sidebars-tools.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* This file is part of the xPack project (http://xpack.github.io).
3+
* Copyright (c) 2024 Liviu Ionescu. All rights reserved.
4+
*
5+
* Permission to use, copy, modify, and/or distribute this software
6+
* for any purpose is hereby granted, under the terms of the MIT license.
7+
*
8+
* If a copy of the license was not distributed with this file, it can
9+
* be obtained from https://opensource.org/licenses/MIT/.
10+
*/
11+
12+
import type {SidebarConfig} from '@docusaurus/plugin-content-docs';
13+
14+
import appTools from './tools'
15+
16+
function itemsOf(tools) {
17+
return tools.map((tool) => {
18+
return {
19+
type: 'link',
20+
label: tool.appName,
21+
href: 'https://xpack-dev-tools.github.io/' + tool.appLcName,
22+
}
23+
})
24+
}
25+
26+
const toolsSidebar: SidebarConfig = [
27+
{
28+
type: 'doc',
29+
label: 'Tools',
30+
id: 'tools/index'
31+
},
32+
{
33+
type: 'category',
34+
label: 'Main Tools',
35+
collapsed: false,
36+
items: itemsOf(appTools.mainTools)
37+
},
38+
{
39+
type: 'category',
40+
label: 'Supplementary Tools',
41+
collapsed: true,
42+
items: itemsOf(appTools.supplementaryTools)
43+
},
44+
]
45+
;
46+
47+
export default toolsSidebar;

website/sidebars.ts

Lines changed: 5 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
55

6+
7+
import toolsSidebar from './sidebars-tools.js';
8+
9+
610
/**
711
* Creating a sidebar enables you to:
812
- create an ordered group of docs
@@ -30,132 +34,7 @@ const sidebars: SidebarsConfig = {
3034
label: 'About'
3135
},
3236
],
33-
toolsSidebar: [
34-
{
35-
type: 'doc',
36-
label: 'Tools',
37-
id: 'tools/index'
38-
},
39-
{
40-
type: 'category',
41-
label: 'Main Tools',
42-
collapsed: false,
43-
items: [
44-
{
45-
type: 'link',
46-
label: 'xPack GNU AArch64 Embedded GCC',
47-
href: 'https://xpack-dev-tools.github.io/aarch64-none-elf-gcc-xpack/',
48-
},
49-
{
50-
type: 'link',
51-
label: 'xPack GNU Arm Embedded GCC',
52-
href: 'https://xpack-dev-tools.github.io/arm-none-eabi-gcc-xpack/',
53-
},
54-
{
55-
type: 'link',
56-
label: 'xPack LLVM clang',
57-
href: 'https://xpack-dev-tools.github.io/clang-xpack/',
58-
},
59-
{
60-
type: 'link',
61-
label: 'xPack CMake',
62-
href: 'https://xpack-dev-tools.github.io/cmake-xpack/',
63-
},
64-
{
65-
type: 'link',
66-
label: 'xPack GNU GCC',
67-
href: 'https://xpack-dev-tools.github.io/gcc-xpack/',
68-
},
69-
{
70-
type: 'link',
71-
label: 'xPack Meson Build',
72-
href: 'https://xpack-dev-tools.github.io/meson-build-xpack/',
73-
},
74-
{
75-
type: 'link',
76-
label: 'xPack MinGW-w64 GCC',
77-
href: 'https://xpack-dev-tools.github.io/mingw-w64-gcc-xpack/',
78-
},
79-
{
80-
type: 'link',
81-
label: 'xPack Ninja Build',
82-
href: 'https://xpack-dev-tools.github.io/ninja-build-xpack/',
83-
},
84-
{
85-
type: 'link',
86-
label: 'xPack OpenOCD',
87-
href: 'https://xpack-dev-tools.github.io/openocd-xpack/',
88-
},
89-
{
90-
type: 'link',
91-
label: 'xPack QEMU Arm',
92-
href: 'https://xpack-dev-tools.github.io/qemu-arm-xpack/',
93-
},
94-
{
95-
type: 'link',
96-
label: 'xPack QEMU RISC-V',
97-
href: 'https://xpack-dev-tools.github.io/qemu-riscv-xpack/',
98-
},
99-
{
100-
type: 'link',
101-
label: 'xPack GNU RISC-V Embedded GCC',
102-
href: 'https://xpack-dev-tools.github.io/riscv-none-elf-gcc-xpack/',
103-
},
104-
{
105-
type: 'link',
106-
label: 'xPack Windows Build Tools',
107-
href: 'https://xpack-dev-tools.github.io/windows-build-tools-xpack/',
108-
},
109-
]
110-
},
111-
{
112-
type: 'category',
113-
label: 'Supplementary Tools',
114-
collapsed: true,
115-
items: [
116-
{
117-
type: 'link',
118-
label: 'xPack bison',
119-
href: 'https://xpack-dev-tools.github.io/bison-xpack/',
120-
},
121-
{
122-
type: 'link',
123-
label: 'xPack flex',
124-
href: 'https://xpack-dev-tools.github.io/flex-xpack/',
125-
},
126-
{
127-
type: 'link',
128-
label: 'xPack GNU m4',
129-
href: 'https://xpack-dev-tools.github.io/m4-xpack/',
130-
},
131-
{
132-
type: 'link',
133-
label: 'xPack NixOS PatchELF',
134-
href: 'https://xpack-dev-tools.github.io/patchelf-xpack/',
135-
},
136-
{
137-
type: 'link',
138-
label: 'xPack pkg-config',
139-
href: 'https://xpack-dev-tools.github.io/pkg-config-xpack/',
140-
},
141-
{
142-
type: 'link',
143-
label: 'xPack GNU realpath',
144-
href: 'https://xpack-dev-tools.github.io/realpath-xpack/',
145-
},
146-
{
147-
type: 'link',
148-
label: 'xPack GNU sed',
149-
href: 'https://xpack-dev-tools.github.io/sed-xpack/',
150-
},
151-
{
152-
type: 'link',
153-
label: 'xPack WineHQ',
154-
href: 'https://xpack-dev-tools.github.io/wine-xpack/',
155-
},
156-
]
157-
},
158-
]
37+
toolsSidebar,
15938
};
16039

16140
export default sidebars;

website/src/components/HomepageTools/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import styles from './styles.module.css';
1818

1919
import Link from '@docusaurus/Link';
2020

21-
import tools from '@site/src/libs/tools';
21+
import tools from '@site/tools';
2222

2323
function Tool({ appName, appLcName }) {
2424
return (
@@ -53,7 +53,7 @@ function ToolsLeft() {
5353
<div className={clsx('col col--6')}>
5454
<div className="text--center padding-horiz--md padding-vert--lg">
5555
<Heading as="h2">Main Tools</Heading>
56-
{tools().mainTools.map((props, idx) => (
56+
{tools.mainTools.map((props, idx) => (
5757
<Tool {...props} />
5858
))}
5959
</div>
@@ -66,14 +66,14 @@ function ToolsRight() {
6666
<div className={clsx('col col--6')}>
6767
<div className="text--center padding-horiz--md padding-vert--lg">
6868
<Heading as="h2">Supplementary Tools</Heading>
69-
{tools().supplementaryTools.map((props, idx) => (
69+
{tools.supplementaryTools.map((props, idx) => (
7070
<Tool {...props} />
7171
))}
7272
</div>
7373
<hr className="hero__hr2" />
7474
<div className="text--center padding-horiz--md padding-vert--md">
7575
<Heading as="h2">Work in Progress</Heading>
76-
{tools().workInProgressTools.map((props, idx) => (
76+
{tools.workInProgressTools.map((props, idx) => (
7777
<ToolWork {...props} />
7878
))}
7979
</div>

website/src/libs/addToolsToSidebar.ts

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

0 commit comments

Comments
 (0)