Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat: add serch icon #1010

shuai3a1e268a1752
diff --git a/ui/src/components/Header/index.scss b/ui/src/components/Header/index.scss
index 1a02c332..d0ee60c8 100644
--- a/ui/src/components/Header/index.scss
+++ b/ui/src/components/Header/index.scss
@@ -55,6 +55,7 @@
// style for colored navbar
&.theme-colored {
.placeholder-search {
+ padding-left: 42px;
box-shadow: none;
color: #fff;
background-color: rgba(255, 255, 255, .2);
@@ -66,6 +67,9 @@
color: rgba(255, 255, 255, 0.75);
}
}
+ .search-icon {
+ color: #fff;
+ }
}
// style for colored navbar
@@ -75,6 +79,7 @@
color: rgba(0, 0, 0, 0.65);
}
.placeholder-search {
+ padding-left: 42px;
box-shadow: none;
color: var(--bs-body-color);
background-color: rgba(255, 255, 255, .2);
@@ -86,11 +91,21 @@
color: rgba(0, 0, 0, 0.65);
}
}
+ .search-icon {
+ color: var(--bs-body-color);
+ }
}
.maxw-400 {
max-width: 400px;;
}
+
+ .search-wrap {
+ position: absolute;
+ top: 0;
+ left: 0;
+ padding: 0.5rem 1rem;
+ }
}
diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsx
index 2757f6c1..28e8370f 100644
--- a/ui/src/components/Header/index.tsx
+++ b/ui/src/components/Header/index.tsx
@@ -47,6 +47,7 @@ import {
sideNavStore,
} from '@/stores';
import { logout, useQueryNotificationStatus } from '@/services';
+import { Icon } from '@/components';
import NavItems from './components/NavItems';
@@ -205,8 +206,11 @@ const Header: FC = () => {
<Col lg={8} className="ps-0">
<Form
action="/search"
- className="w-100 maxw-400"
+ className="w-100 maxw-400 position-relative"
onSubmit={handleSearch}>
+ <div className="search-wrap" onClick={handleSearch}>
+ <Icon name="search" className="search-icon" />
+ </div>
<FormControl
type="search"
placeholder={t('header.search.placeholder')}