Skip to content

Commit 1bbdd05

Browse files
committed
Revise code comments for clarity
1 parent 77a2307 commit 1bbdd05

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

src/components/Support/ContactSupportLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const ContactSupportLink: React.FC = () => {
55
const location = useLocation();
66
const [storedUrl, setStoredUrl] = useState<string | null>(null);
77

8-
// Detect the language based on the URL path
8+
// Detect the language based on the URL path.
99
const isJapanese = location.pathname.startsWith("/ja-jp");
1010

1111
useEffect(() => {

src/components/Support/SupportDropdownMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const DropdownMenu: React.FC = () => {
1010
const [isModalOpen, setIsModalOpen] = useState(false); // For modal visibility
1111
const dropdownRef = useRef<HTMLDivElement>(null);
1212

13-
// Detect the language based on the URL path
13+
// Detect the language based on the URL path.
1414
const isJapanese = window.location.pathname.startsWith("/ja-jp");
1515

1616
const toggleDropdown = () => {
@@ -27,7 +27,7 @@ const DropdownMenu: React.FC = () => {
2727
setIsModalOpen(false);
2828
};
2929

30-
// Close dropdown if clicking outside
30+
// Close the dropdown when clicking outside of the content container.
3131
useEffect(() => {
3232
function handleClickOutside(event: MouseEvent) {
3333
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {

src/css/SupportDropdownMenu.module.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
display: flex;
1414
font-size: 14px;
1515
font-weight: 700;
16-
justify-content: space-between; /* Pushes text to the left and icon to the right. */
16+
justify-content: space-between;
1717
min-width: 140px;
1818
padding: 6px 12px;
1919
text-align: left;
@@ -36,14 +36,15 @@
3636
z-index: 1;
3737
}
3838

39-
/* Change position to left on mobile screens. */
39+
/* Support dropdown button for mobile screens. */
4040
@media (max-width: 996px) { /* Adjust breakpoint if needed. */
4141
.supportDropBtn {
4242
font-size: 15px;
4343
}
4444
.supportDropdownContent {
4545
font-size: 15px;
4646
left: 0;
47+
min-width: 320px;
4748
}
4849
}
4950

src/theme/DocItem/Layout/index.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import SupportDropdownMenu from '@site/src/components/Support/SupportDropdownMen
1717
import styles from './styles.module.css';
1818

1919
/**
20-
* Decide if the toc should be rendered, on mobile or desktop viewports
20+
* Decide if the ToC should be rendered, on mobile or desktop viewports.
2121
*/
2222
function useDocTOC() {
2323
const {frontMatter, toc} = useDoc();
@@ -42,9 +42,9 @@ function useDocTOC() {
4242

4343
export default function DocItemLayout({children}: Props): JSX.Element {
4444
const docTOC = useDocTOC();
45-
const {metadata, frontMatter} = useDoc(); // Get frontMatter to check for hide_table_of_contents
46-
const hideTOC = frontMatter.hide_table_of_contents; // Check if TOC is hidden
47-
const windowSize = useWindowSize(); // Get current window size
45+
const {metadata, frontMatter} = useDoc(); // Get the front-matter metadata to check for the `hide_table_of_contents` configuration.
46+
const hideTOC = frontMatter.hide_table_of_contents; // Check if the ToC is hidden.
47+
const windowSize = useWindowSize(); // Get the current window size.
4848

4949
return (
5050
<div className="row">
@@ -55,7 +55,7 @@ export default function DocItemLayout({children}: Props): JSX.Element {
5555
<article>
5656
<DocBreadcrumbs />
5757
<DocVersionBadge />
58-
{/* Show Support button on mobile */}
58+
{/* Show the Support button on mobile. */}
5959
{windowSize === 'mobile' && (
6060
<div style={{ display: 'flex', justifyContent: 'left', marginBottom: '1rem' }}>
6161
<SupportDropdownMenu />
@@ -69,16 +69,16 @@ export default function DocItemLayout({children}: Props): JSX.Element {
6969
</div>
7070
</div>
7171

72-
{/* Ensure the right column always exists, even if there is no TOC */}
72+
{/* Ensure the right column always exists, even if there is no ToC. */}
7373
{!hideTOC && windowSize !== 'mobile' && (
7474
<div className="col col--3" style={{ position: "relative" }}>
75-
{/* Add a wrapper div to make the support dropdown and TOC sticky */}
75+
{/* Add a wrapper div to make the support dropdown and ToC sticky. */}
7676
<div style={{ position: "sticky", top: "80px", zIndex: 1 }}>
77-
{/* Add the support dropdown above the TOC on desktop */}
77+
{/* Add the support dropdown above the ToC on desktop. */}
7878
<div style={{ display: 'flex', justifyContent: 'flex-start', padding: '0px 17px', right: '0' }}>
7979
<SupportDropdownMenu />
8080
</div>
81-
{/* Render TOC if available */}
81+
{/* Render the ToC if one is available. */}
8282
{docTOC.desktop}
8383
</div>
8484
</div>

0 commit comments

Comments
 (0)