Skip to content

Commit 2c4180b

Browse files
committed
Fix design on API reference page
1 parent 14fc012 commit 2c4180b

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

apify-docs-theme/src/theme/LLMButtons/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import clsx from 'clsx';
12
import React, { useCallback, useState } from 'react';
23

34
import {
@@ -240,7 +241,7 @@ const Option = ({ Icon, label, description, showExternalIcon }) => (
240241
</div>
241242
);
242243

243-
export default function LLMButtons() {
244+
export default function LLMButtons({ isApiReferencePage = false }) {
244245
const [copyingStatus, setCopyingStatus] = useState('idle');
245246
const chevronIconRef = React.useRef(null);
246247

@@ -268,7 +269,9 @@ export default function LLMButtons() {
268269

269270
return (
270271
<Menu
271-
className={styles.llmMenu}
272+
className={clsx(styles.llmMenu, {
273+
[styles.llmMenuApiReferencePage]: isApiReferencePage,
274+
})}
272275
onMenuOpen={(isOpen) => chevronIconRef.current?.classList.toggle(
273276
styles.chevronIconOpen,
274277
isOpen,

apify-docs-theme/src/theme/LLMButtons/styles.module.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
.llmMenu {
77
margin-top: 1.2rem;
8+
width: fit-content;
89

910
@media (min-width: 768px) {
1011
margin-left: auto;
@@ -21,6 +22,15 @@
2122
}
2223
}
2324

25+
.llmMenuApiReferencePage {
26+
margin-top: -0.8rem;
27+
margin-bottom: calc(var(--ifm-h1-vertical-rhythm-bottom) * var(--ifm-leading));
28+
margin-left: 0 !important;
29+
.llmButtonWrapper {
30+
width: fit-content !important;
31+
}
32+
}
33+
2434
.llmButton {
2535
width: fit-content;
2636
display: inline-flex;

docusaurus.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ module.exports = {
200200
// Find the first Heading h1 and add LLMButtons after it
201201
// eslint-disable-next-line max-len
202202
const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;
203-
md = md.replace(headingRegex, '$1\n\n<LLMButtons />\n');
203+
md = md.replace(headingRegex, '$1\n\n<LLMButtons isApiReferencePage />\n');
204204

205205
return md;
206206
},
@@ -210,7 +210,7 @@ module.exports = {
210210
// Find the first Heading h1 and add LLMButtons after it
211211
// eslint-disable-next-line max-len
212212
const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;
213-
md = md.replace(headingRegex, '$1\n\n<LLMButtons />\n');
213+
md = md.replace(headingRegex, '$1\n\n<LLMButtons isApiReferencePage />\n');
214214

215215
return md;
216216
},

0 commit comments

Comments
 (0)