-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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): DocPage theme refactors polish (#7268)
- Loading branch information
Showing
13 changed files
with
219 additions
and
164 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
28 changes: 28 additions & 0 deletions
28
packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Main.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,28 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
.docMainContainer { | ||
display: flex; | ||
width: 100%; | ||
} | ||
|
||
@media (min-width: 997px) { | ||
.docMainContainer { | ||
flex-grow: 1; | ||
max-width: calc(100% - var(--doc-sidebar-width)); | ||
} | ||
|
||
.docMainContainerEnhanced { | ||
max-width: calc(100% - var(--doc-sidebar-hidden-width)); | ||
} | ||
|
||
.docItemWrapperEnhanced { | ||
max-width: calc( | ||
var(--ifm-container-width) + var(--doc-sidebar-width) | ||
) !important; | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/ExpandButton.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,37 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
@media (min-width: 997px) { | ||
.expandButton { | ||
position: sticky; | ||
top: 0; | ||
height: 100%; | ||
max-height: 100vh; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
transition: background-color var(--ifm-transition-fast) ease; | ||
} | ||
|
||
.expandButton:hover, | ||
.expandButton:focus { | ||
background-color: var(--ifm-color-emphasis-200); | ||
} | ||
|
||
.expandButtonIcon { | ||
transform: rotate(0); | ||
} | ||
|
||
[dir='rtl'] .expandButtonIcon { | ||
transform: rotate(180deg); | ||
} | ||
|
||
[data-theme='dark'] .expandButton:hover, | ||
[data-theme='dark'] .expandButton:focus { | ||
background-color: var(--collapse-button-bg-color-dark); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/ExpandButton.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,40 @@ | ||
/** | ||
* 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 IconArrow from '@theme/IconArrow'; | ||
import {translate} from '@docusaurus/Translate'; | ||
import type {Props} from '@theme/DocPage/Layout/Sidebar/ExpandButton'; | ||
|
||
import styles from './ExpandButton.module.css'; | ||
|
||
export default function DocPageLayoutSidebarExpandButton({ | ||
toggleSidebar, | ||
}: Props): JSX.Element { | ||
return ( | ||
<div | ||
className={styles.expandButton} | ||
title={translate({ | ||
id: 'theme.docs.sidebar.expandButtonTitle', | ||
message: 'Expand sidebar', | ||
description: | ||
'The ARIA label and title attribute for expand button of doc sidebar', | ||
})} | ||
aria-label={translate({ | ||
id: 'theme.docs.sidebar.expandButtonAriaLabel', | ||
message: 'Expand sidebar', | ||
description: | ||
'The ARIA label and title attribute for expand button of doc sidebar', | ||
})} | ||
tabIndex={0} | ||
role="button" | ||
onKeyDown={toggleSidebar} | ||
onClick={toggleSidebar}> | ||
<IconArrow className={styles.expandButtonIcon} /> | ||
</div> | ||
); | ||
} |
32 changes: 32 additions & 0 deletions
32
packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.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,32 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
:root { | ||
--doc-sidebar-width: 300px; | ||
--doc-sidebar-hidden-width: 30px; | ||
} | ||
|
||
.docSidebarContainer { | ||
display: none; | ||
} | ||
|
||
@media (min-width: 997px) { | ||
.docSidebarContainer { | ||
display: block; | ||
width: var(--doc-sidebar-width); | ||
margin-top: calc(-1 * var(--ifm-navbar-height)); | ||
border-right: 1px solid var(--ifm-toc-border-color); | ||
will-change: width; | ||
transition: width var(--ifm-transition-fast) ease; | ||
clip-path: inset(0); | ||
} | ||
|
||
.docSidebarContainerHidden { | ||
width: var(--doc-sidebar-hidden-width); | ||
cursor: pointer; | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.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,15 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
.docPage { | ||
display: flex; | ||
width: 100%; | ||
} | ||
|
||
.docsWrapper { | ||
display: flex; | ||
} |
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
87 changes: 0 additions & 87 deletions
87
packages/docusaurus-theme-classic/src/theme/DocPage/Layout/styles.module.css
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.