Skip to content

Commit 408da9b

Browse files
authored
feat(chat): redesign page actions button and move into breadcrumb row (#425)
Replace the absolute-positioned three-dot icon with a labeled "Ask AI" button (Sparkles icon + chevron) styled in the primary brand color. Position it inline with breadcrumbs using a flex row layout. Add dark theme outlined variant. Rename navbar AI link to "Babylon AI".
1 parent 464dfdd commit 408da9b

5 files changed

Lines changed: 73 additions & 40 deletions

File tree

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ const config = {
346346
to: 'https://discord.com/invite/babylonglobal',
347347
},
348348
{
349-
label: 'Ask AI',
349+
label: 'Babylon AI',
350350
to: '#',
351351
className: 'header-ai-chat-link',
352352
position: 'right',

src/components/PageActionsDropdown.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useState, useEffect, useRef, useCallback } from 'react';
22
import {
33
Bot,
4+
ChevronDown,
45
MessageSquare,
5-
MoreVertical,
66
Sparkles,
77
} from 'lucide-react';
88

@@ -74,7 +74,9 @@ export default function PageActionsDropdown() {
7474
aria-haspopup="true"
7575
title="Chat about this page"
7676
>
77-
<MoreVertical size={18} />
77+
<Sparkles size={16} className="page-actions-trigger-icon" />
78+
<span className="page-actions-trigger-label">Ask AI</span>
79+
<ChevronDown size={16} className="page-actions-trigger-chevron" />
7880
</button>
7981

8082
{isOpen && (

src/css/custom.css

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -647,47 +647,81 @@ table th {
647647
color: var(--docs-color-text-100);
648648
}
649649

650-
/* ─── Page Actions Dropdown ───────────────────────────── */
650+
/* ─── Page Actions Dropdown (in breadcrumb row) ────────── */
651651

652-
.doc-content-with-actions {
653-
position: relative;
652+
/* Row: breadcrumbs on the left, Ask AI button on the right */
653+
.doc-breadcrumbs-row {
654+
display: flex;
655+
align-items: center;
656+
justify-content: space-between;
657+
gap: 12px;
658+
flex-wrap: wrap;
659+
margin-bottom: 0.5rem;
660+
min-height: 0;
661+
}
662+
663+
.doc-breadcrumbs-row > *:first-child {
664+
flex: 1;
665+
min-width: 0;
654666
}
655667

656-
/* Prevent the h1 title from overlapping the trigger button */
657-
.doc-content-with-actions .theme-doc-markdown > header {
658-
padding-right: 40px;
668+
.doc-breadcrumbs-row .breadcrumbs {
669+
min-width: 0;
659670
}
660671

661672
.page-actions-dropdown {
662-
position: absolute;
663-
top: 4px;
664-
right: 0;
665-
z-index: 10;
673+
position: relative; /* so .page-actions-menu positions below the button */
674+
flex-shrink: 0;
675+
z-index: 20; /* above breadcrumb area so clicks reach the button */
666676
}
667677

668678
.page-actions-trigger {
679+
position: relative;
669680
display: flex;
670681
align-items: center;
671682
justify-content: center;
672-
width: 32px;
683+
gap: 6px;
673684
height: 32px;
674-
padding: 0;
675-
border: 1px solid var(--ifm-color-emphasis-300);
685+
padding: 0 12px;
686+
border: none;
676687
border-radius: 6px;
677-
background: var(--ifm-background-color);
678-
color: var(--ifm-color-emphasis-700);
688+
background: var(--ifm-color-primary);
689+
color: #fff;
690+
font-size: 13px;
691+
font-weight: 600;
679692
cursor: pointer;
680-
transition: background-color 0.15s, border-color 0.15s;
693+
transition: background-color 0.15s, filter 0.15s;
681694
}
682695

683696
.page-actions-trigger:hover {
684-
background: var(--ifm-color-emphasis-100);
685-
border-color: var(--ifm-color-emphasis-400);
697+
filter: brightness(0.9);
686698
}
687699

688700
.page-actions-trigger[aria-expanded='true'] {
689-
background: var(--ifm-color-emphasis-100);
690-
border-color: var(--ifm-color-emphasis-400);
701+
filter: brightness(0.9);
702+
}
703+
704+
.page-actions-trigger-icon,
705+
.page-actions-trigger-chevron {
706+
flex-shrink: 0;
707+
}
708+
709+
.page-actions-trigger-label {
710+
white-space: nowrap;
711+
}
712+
713+
/* Dark theme: outlined style for sidebar Ask AI button */
714+
html[data-theme='dark'] .page-actions-trigger {
715+
background: transparent;
716+
color: rgb(var(--docs-color-primary-100));
717+
border: 1px solid rgb(var(--docs-color-primary-100));
718+
}
719+
720+
html[data-theme='dark'] .page-actions-trigger:hover,
721+
html[data-theme='dark'] .page-actions-trigger[aria-expanded='true'] {
722+
filter: none;
723+
border-color: rgb(var(--docs-color-primary-200));
724+
color: #33c5ce;
691725
}
692726

693727
.page-actions-menu {
@@ -748,15 +782,8 @@ html[data-theme='dark'] .page-actions-menu {
748782
}
749783

750784
@media (max-width: 576px) {
751-
.page-actions-dropdown {
752-
position: relative; /* keep as positioning context so menu appears below trigger */
753-
display: flex;
754-
justify-content: flex-end;
755-
margin-bottom: 8px;
756-
}
757-
758-
.doc-content-with-actions .theme-doc-markdown > header {
759-
padding-right: 0;
785+
.doc-breadcrumbs-row {
786+
gap: 8px;
760787
}
761788

762789
.page-actions-menu {

src/theme/ApiItem/Layout/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,18 @@ export default function DocItemLayout({ children }) {
4343
<DocVersionBanner />
4444
<div className={styles.docItemContainer}>
4545
<article>
46-
<DocBreadcrumbs />
47-
<DocVersionBadge />
48-
{docTOC.mobile}
49-
<div className="doc-content-with-actions">
46+
<div className="doc-breadcrumbs-row">
47+
<DocBreadcrumbs />
5048
<BrowserOnly>
5149
{() => {
5250
const PageActionsDropdown = require('@site/src/components/PageActionsDropdown').default;
5351
return <PageActionsDropdown />;
5452
}}
5553
</BrowserOnly>
54+
</div>
55+
<DocVersionBadge />
56+
{docTOC.mobile}
57+
<div className="doc-content-with-actions">
5658
<DocItemContent>{children}</DocItemContent>
5759
</div>
5860
<div className="row">

src/theme/DocItem/Layout/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ export default function DocItemLayout({ children }) {
4141
<DocVersionBanner />
4242
<div className={styles.docItemContainer}>
4343
<article>
44-
<DocBreadcrumbs />
45-
<DocVersionBadge />
46-
{docTOC.mobile}
47-
<div className="doc-content-with-actions">
44+
<div className="doc-breadcrumbs-row">
45+
<DocBreadcrumbs />
4846
<BrowserOnly>
4947
{() => {
5048
const PageActionsDropdown = require('@site/src/components/PageActionsDropdown').default;
5149
return <PageActionsDropdown />;
5250
}}
5351
</BrowserOnly>
52+
</div>
53+
<DocVersionBadge />
54+
{docTOC.mobile}
55+
<div className="doc-content-with-actions">
5456
<DocItemContent>{children}</DocItemContent>
5557
</div>
5658
<DocItemFooter />

0 commit comments

Comments
 (0)