Skip to content

Commit 006fab3

Browse files
committed
feat: enhance index file generation and update header with new Calendar icon
1 parent 38a868a commit 006fab3

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

apps/spectator/src/components/layout/header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HCCLogo } from '@hcc/icons';
1+
import { CalendarMonthIcon, HCCLogo } from '@hcc/icons';
22
import Link from 'next/link';
33
import { ROUTES } from '~/constants/routes';
44

@@ -8,6 +8,10 @@ export const Header = () => {
88
<Link href={ROUTES.HOME}>
99
<HCCLogo width="71.5" height="21" className="text-primary-500" />
1010
</Link>
11+
12+
<Link href={ROUTES.CALENDAR}>
13+
<CalendarMonthIcon />
14+
</Link>
1115
</header>
1216
);
1317
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const ROUTES = {
22
HOME: '/',
3+
CALENDAR: '/calendar',
34
};

packages/icons/build.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,26 @@ import pkg from './package.json' with { type: 'json' };
55

66
function generateIndexFiles() {
77
const componentsDir = './src/components';
8-
const subdirs = ['brand', 'semantic'];
8+
9+
if (!fs.existsSync(componentsDir)) {
10+
console.log(`Directory ${componentsDir} does not exist, skipping...`);
11+
return;
12+
}
13+
14+
const subdirs = fs
15+
.readdirSync(componentsDir, { withFileTypes: true })
16+
.filter(dirent => dirent.isDirectory())
17+
.map(dirent => dirent.name);
18+
19+
if (subdirs.length === 0) {
20+
console.log(`No subdirectories found in ${componentsDir}`);
21+
return;
22+
}
923

1024
subdirs.forEach(subdir => {
1125
const subdirPath = path.join(componentsDir, subdir);
1226
const indexPath = path.join(subdirPath, 'index.ts');
1327

14-
if (!fs.existsSync(subdirPath)) {
15-
console.log(`Directory ${subdirPath} does not exist, skipping...`);
16-
return;
17-
}
18-
1928
const files = fs
2029
.readdirSync(subdirPath)
2130
.filter(file => file.endsWith('.tsx'))
@@ -31,6 +40,14 @@ function generateIndexFiles() {
3140

3241
console.log(`Generated ${indexPath} with ${files.length} exports:`, files);
3342
});
43+
44+
const srcIndexPath = './src/index.ts';
45+
const srcIndexExports = subdirs
46+
.map(subdir => `export * from './components/${subdir}';`)
47+
.join('\n');
48+
fs.writeFileSync(srcIndexPath, srcIndexExports);
49+
50+
console.log(`Generated ${srcIndexPath} with exports from:`, subdirs);
3451
}
3552

3653
generateIndexFiles();

packages/icons/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './components/brand';
2+
export * from './components/semantic';

0 commit comments

Comments
 (0)