Skip to content

Commit

Permalink
feat(style): use a compact layout when there are many nav items (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Sep 13, 2024
1 parent 22552b5 commit 174b188
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface Props {
langs?: string[];
base: string;
rightIcon?: React.ReactNode;
compact?: boolean;
}

export function NavMenuSingleItem(
Expand All @@ -28,7 +29,7 @@ export function NavMenuSingleItem(
key={item.text}
className={`rspress-nav-menu-item ${styles.singleItem} ${
isActive ? styles.activeItem : ''
} text-sm font-medium mx-1.5 px-3 py-2 flex items-center`}
} text-sm font-medium ${item.compact ? 'mx-0.5' : 'mx-1.5'} px-3 py-2 flex items-center`}
>
<Tag tag={item.tag} />
{item.text}
Expand Down
1 change: 1 addition & 0 deletions packages/theme-default/src/components/Nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function Nav(props: NavProps) {
langs={langs}
base={base}
key={item.link}
compact={menuItems.length > 5}
{...item}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
cursor: pointer;
}

@media (max-width: 768px) {
@media (max-width: 960px) {
.navSearchButton {
display: none;
}
Expand Down

0 comments on commit 174b188

Please sign in to comment.