This is an automated email from the ASF dual-hosted git repository.
jeffreyh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new fea2e4162c1 feat:modify ask ai position (#3483)
fea2e4162c1 is described below
commit fea2e4162c1dc71e5164361862457a9cfb102c53
Author: yangon <[email protected]>
AuthorDate: Mon Mar 23 19:56:36 2026 +0800
feat:modify ask ai position (#3483)
<img width="2680" height="990" alt="image"
src="https://github.com/user-attachments/assets/44b9bff9-1e12-40d2-a237-d3c85d84ef55"
/>
---
src/scss/components/navbar.scss | 31 +++++++++++++++++++---
src/theme/BlogListPage/index.tsx | 18 +++++++++----
src/theme/Navbar/Content/components/NavbarDocs.tsx | 17 +++++++++++-
src/theme/Navbar/Content/index.tsx | 16 ++++++-----
4 files changed, 65 insertions(+), 17 deletions(-)
diff --git a/src/scss/components/navbar.scss b/src/scss/components/navbar.scss
index 3182ae81eee..3e79b156124 100644
--- a/src/scss/components/navbar.scss
+++ b/src/scss/components/navbar.scss
@@ -1,4 +1,8 @@
.navbar {
+ button {
+ cursor: pointer !important;
+ }
+
height: var(--global-header-height);
background-color: var(--global-colors-white);
padding: 0;
@@ -15,13 +19,25 @@
.navbar-left {
display: flex;
- .docs-search {
+ .docs-search-container {
position: absolute;
left: 50%;
- transform: translateX(-50%);
- width: 38vw;
top: 12px;
- max-width: 443px;
+ transform: translateX(-50%);
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+
+ .docs-search {
+ position: static;
+ transform: none;
+ width: 38vw;
+ max-width: 443px;
+ }
+
+ .navbar-ask-ai-btn {
+ white-space: nowrap;
+ }
}
.navbar__link {
@@ -216,6 +232,10 @@
}
}
+ .navbar-ask-ai-btn {
+ cursor: pointer;
+ }
+
.dropdown__menu {
box-shadow: 0px 6px 20px rgba(6, 128, 95, 0.12);
border-radius: 0.5rem;
@@ -351,6 +371,9 @@
}
}
}
+ .docs-search-container {
+ display: none;
+ }
.docs-search {
display: none;
}
diff --git a/src/theme/BlogListPage/index.tsx b/src/theme/BlogListPage/index.tsx
index cbe06ca59e6..b7bf5505e79 100644
--- a/src/theme/BlogListPage/index.tsx
+++ b/src/theme/BlogListPage/index.tsx
@@ -16,6 +16,7 @@ import BlogPostItems from '@theme/BlogPostItems';
import { useHistory, useLocation } from '@docusaurus/router';
// import BlogListPageStructuredData from '@theme/BlogListPage/StructuredData';
const allText = 'All';
+const HIDDEN_BLOG_TABS = new Set(['Release Notes', 'Top News']);
function getBlogCategories(props) {
const { siteConfig } = useDocusaurusContext();
@@ -30,22 +31,29 @@ function getBlogCategories(props) {
items.forEach(({ content: BlogPostContent }) => {
const { frontMatter } = BlogPostContent;
const tags = frontMatter.tags || [];
+
+ if (allCategory.values.every(val => val.metadata.permalink !==
BlogPostContent.metadata.permalink)) {
+ allCategory.values.push(BlogPostContent);
+ }
+
if (tags.length > 0) {
tags.forEach(tag => {
- const index = categories.length > 0 ?
categories.findIndex(cate => cate.label === tag) : -1;
+ const tagLabel = typeof tag === 'string' ? tag : tag?.label;
+ if (!tagLabel || HIDDEN_BLOG_TABS.has(tagLabel)) {
+ return;
+ }
+
+ const index = categories.length > 0 ?
categories.findIndex(cate => cate.label === tagLabel) : -1;
if (index > -1) {
const curCategory = categories[index];
curCategory.values.push(BlogPostContent);
} else {
const category = {
- label: tag,
+ label: tagLabel,
values: [BlogPostContent],
};
categories.push(category);
}
- if (allCategory.values.every(val => val.metadata.permalink !==
BlogPostContent.metadata.permalink)) {
- allCategory.values.push(BlogPostContent);
- }
});
}
});
diff --git a/src/theme/Navbar/Content/components/NavbarDocs.tsx
b/src/theme/Navbar/Content/components/NavbarDocs.tsx
index f238223e8cf..ee79405814c 100644
--- a/src/theme/Navbar/Content/components/NavbarDocs.tsx
+++ b/src/theme/Navbar/Content/components/NavbarDocs.tsx
@@ -16,6 +16,7 @@ import { DataContext } from '../../../Layout';
import { ARCHIVE_PATH } from '../../../../constant/common' ;
import { DEFAULT_VERSION } from '../../../../constant/version' ;
import { getLocalePrefix, normalizePathname } from '@site/src/utils/locale';
+import { StarGreenIcon } from '@site/src/components/Icons/star-green-icon';
interface NavbarDocsProps {
isEN: boolean;
@@ -39,6 +40,8 @@ export const NavbarDocsLeft = ({ isEN }: NavbarDocsProps) => {
if(location.pathname.includes(ARCHIVE_PATH)){
leftDocItems = leftDocItems.filter((item)=>item.type !== 'search')
}
+ const searchItem = getNavItem(leftDocItems, 'search');
+ const leftDocItemsWithoutSearch = leftDocItems.filter((item) => item.type
!== 'search');
useEffect(() => {
const normalizedPathname = normalizePathname(location.pathname,
locales);
const pathSegments = normalizedPathname.split('/');
@@ -66,7 +69,19 @@ export const NavbarDocsLeft = ({ isEN }: NavbarDocsProps) =>
{
</div>
</div>
<div className={`${styles.navbarLeftToc}`}>
- <NavbarItems items={leftDocItems} isDocsPage={true} />
+ <NavbarItems items={leftDocItemsWithoutSearch}
isDocsPage={true} />
+ {searchItem && (
+ <div className="docs-search-container">
+ <NavbarItems items={[searchItem]} isDocsPage={true} />
+ <button
+ className="navbar-ask-ai-btn rounded-full flex
items-center gap-x-2 px-4 py-[5px] border border-primary bg-[#F0FFF7]
text-[1rem]/[1.625rem] font-medium text-[#1D1D1D]"
+ id="navbar-ask-ai-btn"
+ >
+ <StarGreenIcon />
+ Ask AI
+ </button>
+ </div>
+ )}
</div>
</div>
);
diff --git a/src/theme/Navbar/Content/index.tsx
b/src/theme/Navbar/Content/index.tsx
index d68d1c2840e..0a3a3a8f7d4 100644
--- a/src/theme/Navbar/Content/index.tsx
+++ b/src/theme/Navbar/Content/index.tsx
@@ -114,13 +114,15 @@ export default function NavbarContent(): ReactNode {
left={NavbarTypes[currentNavbar].left}
right={
<>
- <button
- className="rounded-full flex items-center gap-x-2 px-4
py-[5px] border border-primary bg-[#F0FFF7] text-[1rem]/[1.625rem] font-medium
text-[#1D1D1D]"
- id="navbar-ask-ai-btn"
- >
- <StarGreenIcon />
- Ask AI
- </button>
+ {currentNavbar !== NavBar.DOCS && (
+ <button
+ className="navbar-ask-ai-btn rounded-full flex
items-center gap-x-2 px-4 py-[5px] border border-primary bg-[#F0FFF7]
text-[1rem]/[1.625rem] font-medium text-[#1D1D1D]"
+ id="navbar-ask-ai-btn"
+ >
+ <StarGreenIcon />
+ Ask AI
+ </button>
+ )}
{NavbarTypes[currentNavbar].right}
{!mobileSidebar.disabled && !showSearchPageMobile &&
<NavbarMobileSidebarToggle />}
<NavbarColorModeToggle className={styles.colorModeToggle}
/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]