Skip to content

Commit 09114ce

Browse files
webrdanielbirosrichardjbartadev
authored
feat: LLMs dropdown (#1956)
<img width="1915" height="986" alt="Screenshot 2025-09-30 at 16 04 30" src="https://github.com/user-attachments/assets/e66b6853-1aaa-4feb-941b-9ede319a33a2" /> <!-- CURSOR_SUMMARY --> > [!NOTE] > Refactors LLM actions into a single dropdown menu and updates the doc header layout and styles, adding UI library/icon deps. > > - **Frontend (theme)**: > - **LLM actions**: > - Replace `CopyForLLM` and `ViewAsMarkdown` buttons with a single dropdown in `theme/LLMButtons/index.jsx` using `@apify/ui-library` `Menu` and `@apify/ui-icons`. > - Implements copy-as-Markdown (with loading/success feedback) and view-as-Markdown actions. > - Removes `theme/LLMButtons/CopyForLLM` and `theme/LLMButtons/ViewAsMarkdown` components. > - Revamps styles in `theme/LLMButtons/styles.module.css` for the new button and menu options. > - **Doc header layout**: > - In `theme/DocItemContent/index.js`, wraps title and LLM controls in a flex container (`styles.docItemContent`), keeping `MDXContent` below; adds `styles.module.css` for layout. > - **Dependencies**: > - Add `@apify/ui-icons` and bump `@apify/ui-library`; update lockfile accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5455d61. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Richard Biroš <[email protected]> Co-authored-by: Jan Bárta <[email protected]>
1 parent 6a94fcc commit 09114ce

File tree

9 files changed

+426
-169
lines changed

9 files changed

+426
-169
lines changed

apify-docs-theme/src/theme/DocItemContent/index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import MDXContent from '@theme/MDXContent';
77
import clsx from 'clsx';
88
import React from 'react';
99

10+
import styles from './styles.module.css';
11+
1012
function useSyntheticTitle() {
1113
const { metadata, frontMatter, contentTitle } = useDoc();
1214
const shouldRender = !frontMatter.hide_title && typeof contentTitle === 'undefined';
@@ -62,11 +64,15 @@ export default function DocItemContent({ children }) {
6264
const shouldShowLLMButtons = allowedPaths.some((path) => location.pathname.startsWith(path))
6365
&& !disallowedPaths.some((path) => location.pathname.includes(path));
6466

65-
return (
66-
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
67-
{syntheticTitle && <Heading as="h1">{syntheticTitle}</Heading>}
68-
{shouldShowLLMButtons && <LLMButtons />}
69-
<MDXContent>{children}</MDXContent>
70-
</div>
71-
);
67+
return (
68+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
69+
{(syntheticTitle || shouldShowLLMButtons) && (
70+
<div className={styles.docItemContent}>
71+
{syntheticTitle && <Heading as="h1">{syntheticTitle}</Heading>}
72+
{shouldShowLLMButtons && <LLMButtons />}
73+
</div>
74+
)}
75+
<MDXContent>{children}</MDXContent>
76+
</div>
77+
);
7278
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.docItemContent {
2+
display: flex;
3+
align-items: center;
4+
flex-wrap: wrap;
5+
/* move the h1 margin to padding */
6+
h1 {
7+
margin-bottom: 0 !important;
8+
}
9+
padding-bottom: calc(
10+
var(--ifm-h1-vertical-rhythm-bottom) * var(--ifm-leading)
11+
);
12+
13+
@media (max-width: 767px) {
14+
flex-direction: column;
15+
align-items: flex-start;
16+
}
17+
}

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

Lines changed: 0 additions & 71 deletions
This file was deleted.

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

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)