Skip to content

Commit 06e3f4e

Browse files
committed
refactor(react-mdx): use split button in docs
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
1 parent b2067b8 commit 06e3f4e

2 files changed

Lines changed: 28 additions & 54 deletions

File tree

packages/frameworks/react-mdx/src/docs-layout/layout/page-actions.tsx

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {type ReactNode, useCallback} from "react"
55

66
import {Check, Copy, Download} from "lucide-react"
77

8-
import {Button} from "@qualcomm-ui/react/button"
98
import {Menu} from "@qualcomm-ui/react/menu"
109
import {Portal} from "@qualcomm-ui/react-core/portal"
1110
import {useSiteContext} from "@qualcomm-ui/react-mdx/context"
@@ -60,49 +59,40 @@ export function PageActions(): ReactNode {
6059

6160
return (
6261
<div className="qui-docs__page-actions">
63-
<div className="qui-docs__page-actions-buttons">
64-
<Button
65-
className="qui-docs__page-actions-copy-button"
62+
<Menu.Root size="sm">
63+
<Menu.SplitButton
6664
endIcon={isCopied ? Check : Copy}
6765
onClick={copyToClipboard}
6866
size="sm"
67+
triggerAriaLabel="More page actions"
6968
variant="outline"
7069
>
7170
Copy Page
72-
</Button>
73-
<Menu.Root size="sm">
74-
<Menu.Trigger>
75-
<Menu.IconButton
76-
className="qui-docs__page-actions-menu-button"
77-
size="sm"
78-
variant="outline"
79-
/>
80-
</Menu.Trigger>
81-
<Portal>
82-
<Menu.Positioner>
83-
<Menu.Content>
84-
<Menu.Item onClick={copyToClipboard} value="copy-page">
85-
<Menu.ItemStartIcon icon={Copy} />
86-
<Menu.ItemLabel>Copy Page</Menu.ItemLabel>
87-
<Menu.ItemDescription>
88-
Copy page as markdown for LLMs
89-
</Menu.ItemDescription>
90-
</Menu.Item>
91-
<Menu.Item
92-
onClick={() => void handleDownload()}
93-
value="download-page"
94-
>
95-
<Menu.ItemStartIcon icon={Download} />
96-
<Menu.ItemLabel>Download Page</Menu.ItemLabel>
97-
<Menu.ItemDescription>
98-
Download page as markdown
99-
</Menu.ItemDescription>
100-
</Menu.Item>
101-
</Menu.Content>
102-
</Menu.Positioner>
103-
</Portal>
104-
</Menu.Root>
105-
</div>
71+
</Menu.SplitButton>
72+
<Portal>
73+
<Menu.Positioner>
74+
<Menu.Content>
75+
<Menu.Item onClick={copyToClipboard} value="copy-page">
76+
<Menu.ItemStartIcon icon={Copy} />
77+
<Menu.ItemLabel>Copy Page</Menu.ItemLabel>
78+
<Menu.ItemDescription>
79+
Copy page as markdown for LLMs
80+
</Menu.ItemDescription>
81+
</Menu.Item>
82+
<Menu.Item
83+
onClick={() => void handleDownload()}
84+
value="download-page"
85+
>
86+
<Menu.ItemStartIcon icon={Download} />
87+
<Menu.ItemLabel>Download Page</Menu.ItemLabel>
88+
<Menu.ItemDescription>
89+
Download page as markdown
90+
</Menu.ItemDescription>
91+
</Menu.Item>
92+
</Menu.Content>
93+
</Menu.Positioner>
94+
</Portal>
95+
</Menu.Root>
10696
</div>
10797
)
10898
}

packages/frameworks/react-mdx/src/docs-layout/mdx.css

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -448,22 +448,6 @@ hr.mdx {
448448
padding-left: 10px;
449449
}
450450

451-
.qui-docs__page-actions-buttons {
452-
align-items: center;
453-
display: flex;
454-
gap: 1px;
455-
}
456-
457-
.qui-docs__page-actions-copy-button[data-size] {
458-
border-bottom-right-radius: 0;
459-
border-top-right-radius: 0;
460-
}
461-
462-
.qui-docs__page-actions-menu-button[data-size] {
463-
border-bottom-left-radius: 0;
464-
border-top-left-radius: 0;
465-
}
466-
467451
.qui-docs__theme-table-scroll-container {
468452
overflow-x: auto;
469453
}

0 commit comments

Comments
 (0)