-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(theme-classic): blog mobile secondary menu use consistent st…
…yles (#7068)
- Loading branch information
Showing
6 changed files
with
113 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/docusaurus-theme-classic/src/theme/BlogSidebar/Desktop/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import Link from '@docusaurus/Link'; | ||
import {translate} from '@docusaurus/Translate'; | ||
|
||
import styles from './styles.module.css'; | ||
import type {Props} from '@theme/BlogSidebar/Desktop'; | ||
|
||
export default function BlogSidebarDesktop({sidebar}: Props): JSX.Element { | ||
return ( | ||
<aside className="col col--3"> | ||
<nav | ||
className={clsx(styles.sidebar, 'thin-scrollbar')} | ||
aria-label={translate({ | ||
id: 'theme.blog.sidebar.navAriaLabel', | ||
message: 'Blog recent posts navigation', | ||
description: 'The ARIA label for recent posts in the blog sidebar', | ||
})}> | ||
<div className={clsx(styles.sidebarItemTitle, 'margin-bottom--md')}> | ||
{sidebar.title} | ||
</div> | ||
<ul className={styles.sidebarItemList}> | ||
{sidebar.items.map((item) => ( | ||
<li key={item.permalink} className={styles.sidebarItem}> | ||
<Link | ||
isNavLink | ||
to={item.permalink} | ||
className={styles.sidebarItemLink} | ||
activeClassName={styles.sidebarItemLinkActive}> | ||
{item.title} | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</nav> | ||
</aside> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,11 +40,7 @@ | |
} | ||
|
||
@media (max-width: 996px) { | ||
.sidebarDesktop { | ||
display: none; | ||
} | ||
|
||
.sidebar { | ||
top: 0; | ||
display: none; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
packages/docusaurus-theme-classic/src/theme/BlogSidebar/Mobile/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import Link from '@docusaurus/Link'; | ||
import {NavbarSecondaryMenuFiller} from '@docusaurus/theme-common'; | ||
import type {Props} from '@theme/BlogSidebar/Mobile'; | ||
|
||
function BlogSidebarMobileSecondaryMenu({sidebar}: Props): JSX.Element { | ||
return ( | ||
<ul className="menu__list"> | ||
{sidebar.items.map((item) => ( | ||
<li key={item.permalink} className="menu__list-item"> | ||
<Link | ||
isNavLink | ||
to={item.permalink} | ||
className="menu__link" | ||
activeClassName="menu__link--active"> | ||
{item.title} | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
} | ||
|
||
export default function BlogSidebarMobile(props: Props): JSX.Element { | ||
return ( | ||
<NavbarSecondaryMenuFiller | ||
component={BlogSidebarMobileSecondaryMenu} | ||
props={props} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters