Skip to content

Commit

Permalink
add Products link in navbar (#1444)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina authored Apr 9, 2024
1 parent 76a9331 commit bad4173
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 287 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-toys-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theguild/components": minor
---

add Products link in navbar
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ storybook-static/
.changeset/*.md
website/out/
pnpm-lock.yaml
CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
import { MenuItem, PageItem } from 'nextra/normalize-pages';
import { PRODUCTS } from '../products';

export const productsItems = Object.fromEntries(
Object.values(PRODUCTS).map(product => [
product.name,
{
title: (
<span className="flex items-center gap-2">
<product.logo className="h-7 w-auto shrink-0" />
{product.name}
</span> // todo: fix type in nextra
) as any,

Check warning on line 13 in packages/components/src/components/company-menu.tsx

View workflow job for this annotation

GitHub Actions / Build

Unexpected any. Specify a different type
href: new URL(product.href).pathname,
},
]),
);

export function addGuildCompanyMenu(items: (PageItem | MenuItem)[]): (PageItem | MenuItem)[] {
return [
Expand All @@ -11,11 +27,6 @@ export function addGuildCompanyMenu(items: (PageItem | MenuItem)[]): (PageItem |
href: 'https://the-guild.dev/about-us',
newWindow: true,
},
solutions: {
title: 'Solutions',
href: 'https://the-guild.dev/solutions',
newWindow: true,
},
blog: {
title: 'Blog',
href: 'https://the-guild.dev/blog',
Expand All @@ -30,6 +41,13 @@ export function addGuildCompanyMenu(items: (PageItem | MenuItem)[]): (PageItem |
name: 'company',
route: '#',
} satisfies MenuItem,
{
type: 'menu',
title: 'Products',
items: productsItems,
name: 'products',
route: '#',
} satisfies MenuItem,
...items,
];
}
34 changes: 0 additions & 34 deletions packages/components/src/components/ecosystem-list.stories.tsx

This file was deleted.

100 changes: 0 additions & 100 deletions packages/components/src/components/ecosystem-list.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion packages/components/src/components/guild-navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReactElement } from 'react';
import clsx from 'clsx';
import { DocsThemeConfig } from 'nextra-theme-docs';
import { GuildLogo, TheGuild } from '../logos';
Expand All @@ -11,7 +12,7 @@ export function GuildUnifiedLogo({
children: DocsThemeConfig['logo'];
title: string;
description: string;
}) {
}): ReactElement {
return (
<>
<Anchor
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export { HeroGradient } from './hero-gradient';
export { HeroIllustration } from './hero-illustration';
export { HeroMarketplace } from './hero-marketplace';
export { HeroVideo } from './hero-video';
export * from './icons/index';
export * from './icons';
export { Image } from './image';
export { InfoList } from './info-list';
export { LegacyPackageCmd } from './legacy-package-cmd';
Expand All @@ -19,3 +19,4 @@ export { NPMBadge } from './npm-badge';
export { Tabs } from './tabs';
export { GuildUnifiedLogo } from './guild-navbar';
export { ThemeSwitcherButton } from './theme-switcher';
export { productsItems } from './company-menu';
10 changes: 0 additions & 10 deletions packages/components/src/components/solutions-menu.stories.tsx

This file was deleted.

121 changes: 0 additions & 121 deletions packages/components/src/components/solutions-menu.tsx

This file was deleted.

7 changes: 5 additions & 2 deletions packages/components/src/define-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export function defineConfig({
description,
logo,
...config
}: DocsThemeConfig & { websiteName: string; description: string }): DocsThemeConfig {
}: DocsThemeConfig & {
websiteName: string;
description: string;
}): DocsThemeConfig {
if (!config.docsRepositoryBase) {
throw new Error('Missing required "docsRepositoryBase" property');
}
Expand Down Expand Up @@ -105,7 +108,7 @@ export function defineConfig({
),
navbar: {
extraContent: <ThemeSwitcherButton />,
component: props => <Navbar items={addGuildCompanyMenu(props.items)} />,
...(logo && { component: props => <Navbar items={addGuildCompanyMenu(props.items)} /> }),
},
...config,
components: {
Expand Down
Loading

0 comments on commit bad4173

Please sign in to comment.