Skip to content

Commit 37ce8c1

Browse files
authored
Merge pull request #3441 from ClickHouse/revert-3440-translate_improvements
Revert "move jp to /docs"
2 parents d12b2da + 2101068 commit 37ce8c1

File tree

2 files changed

+41
-70
lines changed

2 files changed

+41
-70
lines changed

docusaurus.config.jp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const config = {
4646
"ドキュメント、クイックスタートガイド、ユーザーガイド、技術リファレンス、FAQ など、多様な情報をご提供します。",
4747
url: "https://clickhouse.com",
4848
// url: process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'https://bookish-disco-5997zvo.pages.github.io',
49-
baseUrl: "/docs/",
49+
baseUrl: "/jp/docs/",
5050
baseUrlIssueBanner: true,
5151
onBrokenLinks: "warn",
5252
onBrokenMarkdownLinks: "warn",

src/components/DocsCategoryDropdown/index.jsx

Lines changed: 40 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
import React, { useState, useRef, useEffect } from "react";
2-
import { useHistory } from "react-router-dom";
3-
import Link from "@docusaurus/Link";
4-
import { useDocsSidebar } from "@docusaurus/plugin-content-docs/client";
5-
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
6-
import { translate } from "@docusaurus/Translate";
1+
import React, { useState, useRef, useEffect } from 'react';
2+
import { useHistory } from 'react-router-dom';
3+
import Link from '@docusaurus/Link';
4+
import {useDocsSidebar} from '@docusaurus/plugin-content-docs/client';
5+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
76

8-
import styles from "./styles.module.css";
7+
import styles from './styles.module.css';
98

109
function DocsCategoryDropdown({ dropdownCategory }) {
1110
const [isOpen, setIsOpen] = useState(false);
12-
const [dropdownStyles, setDropdownStyles] = useState({
13-
top: "0px",
14-
left: "0px",
15-
});
11+
const [dropdownStyles, setDropdownStyles] = useState({ top: '0px', left: '0px' });
1612
const dropdownMenuRef = useRef(null);
1713
const triggerRef = useRef(null); // Reference for the individual menu item trigger
1814

@@ -40,19 +36,15 @@ function DocsCategoryDropdown({ dropdownCategory }) {
4036
left = triggerRect.right - dropdownRect.width;
4137
} else {
4238
// Align to center
43-
left =
44-
triggerRect.left + triggerRect.width / 2 - dropdownRect.width / 2;
39+
left = triggerRect.left + (triggerRect.width / 2) - (dropdownRect.width / 2);
4540
}
4641

4742
// Ensure the dropdown doesn't go off-screen
48-
left = Math.max(
49-
10,
50-
Math.min(left, viewportWidth - dropdownRect.width - 10),
51-
);
43+
left = Math.max(10, Math.min(left, viewportWidth - dropdownRect.width - 10));
5244

5345
setDropdownStyles({
5446
top: `${triggerRect.bottom}px`, // Align the dropdown below the menu item
55-
left: `${left}px`, // Align the dropdown with the menu item
47+
left: `${left}px` // Align the dropdown with the menu item
5648
});
5749
}
5850
}, [isOpen]); // This runs when the dropdown is opened
@@ -62,13 +54,13 @@ function DocsCategoryDropdown({ dropdownCategory }) {
6254
// Safely call useDocsSidebar
6355
try {
6456
sidebar = useDocsSidebar();
65-
} catch (e) {}
57+
} catch (e) {
58+
}
6659

6760
// Guard against undefined sidebar
68-
const isSelected =
69-
sidebar && sidebar.name && dropdownCategory
70-
? sidebar.name === dropdownCategory.customProps.sidebar
71-
: false;
61+
const isSelected = sidebar && sidebar.name && dropdownCategory
62+
? sidebar.name === dropdownCategory.customProps.sidebar
63+
: false;
7264

7365
return (
7466
<div
@@ -80,18 +72,9 @@ function DocsCategoryDropdown({ dropdownCategory }) {
8072
className={styles.docsNavDropdownToolbarLink}
8173
ref={triggerRef} // Attach the ref to the individual link that triggers the dropdown
8274
>
83-
<Link
84-
className={`${styles.docsNavDropdownToolbarTopLevelLink} ${
85-
isSelected ? styles.docsNavSelected : ""
86-
}`}
87-
href={dropdownCategory.customProps.href}
88-
>
89-
{translate({
90-
id: `sidebar.dropdownCategories.category.${dropdownCategory.label}`,
91-
message: dropdownCategory.label,
92-
})}
93-
</Link>{" "}
94-
<DropdownCaret />
75+
<Link className={`${styles.docsNavDropdownToolbarTopLevelLink} ${
76+
isSelected ? styles.docsNavSelected : ''
77+
}`} href={dropdownCategory.customProps.href}>{dropdownCategory.label}</Link> <DropdownCaret />
9578
</span>
9679
{isOpen && (
9780
<DropdownContent
@@ -108,63 +91,51 @@ function DocsCategoryDropdown({ dropdownCategory }) {
10891
export const DocsCategoryDropdownLinkOnly = ({ title, link }) => {
10992
return (
11093
<div className={styles.docsNavDropdownContainer}>
111-
<Link href={link} className={styles.docsNavDropdownToolbarTopLevelLink}>
112-
<span>{title}</span>
113-
</Link>
94+
<Link href={link} className={styles.docsNavDropdownToolbarTopLevelLink}><span>{title}</span></Link>
11495
</div>
11596
);
116-
};
97+
}
11798

118-
const DropdownContent = ({
119-
dropdownCategory,
120-
handleMouseLeave,
121-
dropdownStyles,
122-
dropdownMenuRef,
123-
}) => {
99+
const DropdownContent = ({ dropdownCategory, handleMouseLeave, dropdownStyles, dropdownMenuRef }) => {
124100
const [hovered, setHovered] = useState(null);
125101

126102
return (
127103
<div
128104
ref={dropdownMenuRef}
129105
className={styles.docsNavDropdownMenu}
130-
style={{ position: "fixed", ...dropdownStyles }}
106+
style={{ position: 'fixed', ...dropdownStyles }}
131107
>
132-
<div
133-
key={99}
134-
className={`${styles.docsNavMenuItem} ${hovered === 99 ? styles.docsNavHovered : ""}`}
135-
onMouseEnter={() => setHovered(99)}
136-
onMouseLeave={() => setHovered(null)}
108+
<div key={99}
109+
className={`${styles.docsNavMenuItem} ${hovered === 99 ? styles.docsNavHovered : ''}`}
110+
onMouseEnter={() => setHovered(99)}
111+
onMouseLeave={() => setHovered(null)}
137112
>
138113
<Link
139-
to={dropdownCategory.customProps.href}
114+
to={dropdownCategory.customProps.href}
140115
className={styles.docsNavMenuHeader}
141-
onClick={handleMouseLeave}
116+
onClick={handleMouseLeave}
142117
>
143118
{dropdownCategory.label}
144119
</Link>
145-
<div className={styles.docsNavMenuDescription}>
146-
{dropdownCategory.description}
147-
</div>
120+
<div className={styles.docsNavMenuDescription}>{dropdownCategory.description}</div>
148121
</div>
149122
<hr className={styles.docsNavMenuDivider} />
150123
<div className={styles.docsNavMenuItems}>
151124
{dropdownCategory.items.map((item, index) => (
152125
<div
153126
key={index}
154-
className={`${styles.docsNavMenuItem} ${hovered === index ? styles.docsNavHovered : ""}`}
127+
className={`${styles.docsNavMenuItem} ${hovered === index ? styles.docsNavHovered : ''}`}
155128
onMouseEnter={() => setHovered(index)}
156129
onMouseLeave={() => setHovered(null)}
157130
>
158131
<Link
159-
to={item.href}
132+
to={item.href}
160133
className={styles.docsNavItemTitle}
161-
onClick={handleMouseLeave}
134+
onClick={handleMouseLeave}
162135
>
163136
{item.label}
164137
</Link>
165-
<div className={styles.docsNavItemDescription}>
166-
{item.description}
167-
</div>
138+
<div className={styles.docsNavItemDescription}>{item.description}</div>
168139
</div>
169140
))}
170141
</div>
@@ -174,20 +145,20 @@ const DropdownContent = ({
174145

175146
const DropdownCaret = () => {
176147
const commonStyle = {
177-
width: "6px",
178-
height: "10px",
179-
fill: "none",
180-
transition: "all 0.3s ease",
181-
color: "#6B7280",
148+
width: '6px',
149+
height: '10px',
150+
fill: 'none',
151+
transition: 'all 0.3s ease',
152+
color: '#6B7280',
182153
};
183154

184155
const rotatedIconStyle = {
185156
...commonStyle,
186-
transform: "rotate(90deg)",
157+
transform: 'rotate(90deg)',
187158
};
188159

189160
return (
190-
<span style={{ marginLeft: "8px" }}>
161+
<span style={{ marginLeft: '8px' }}>
191162
<svg
192163
xmlns="http://www.w3.org/2000/svg"
193164
width="6"

0 commit comments

Comments
 (0)