-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(theme-classic) extract HomeBreadcrumbItem + fix swizzle bugs (#8445)
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
- Loading branch information
1 parent
022e005
commit e1d6292
Showing
9 changed files
with
131 additions
and
32 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
33 changes: 33 additions & 0 deletions
33
packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/Items/Home/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,33 @@ | ||
/** | ||
* 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 useBaseUrl from '@docusaurus/useBaseUrl'; | ||
import {translate} from '@docusaurus/Translate'; | ||
import IconHome from '@theme/Icon/Home'; | ||
|
||
import styles from './styles.module.css'; | ||
|
||
export default function HomeBreadcrumbItem(): JSX.Element { | ||
const homeHref = useBaseUrl('/'); | ||
|
||
return ( | ||
<li className="breadcrumbs__item"> | ||
<Link | ||
aria-label={translate({ | ||
id: 'theme.docs.breadcrumbs.home', | ||
message: 'Home page', | ||
description: 'The ARIA label for the home page in the breadcrumbs', | ||
})} | ||
className="breadcrumbs__link" | ||
href={homeHref}> | ||
<IconHome className={styles.breadcrumbHomeIcon} /> | ||
</Link> | ||
</li> | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/Items/Home/styles.module.css
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,14 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
.breadcrumbHomeIcon { | ||
position: relative; | ||
top: 1px; | ||
vertical-align: top; | ||
height: 1.1rem; | ||
width: 1.1rem; | ||
} |
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
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
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