fix: sidebar search :focus border on Safari

* chore: add placeholder on sidebar search
* chore: modify input:focus border-color to adapting to global theme
This commit is contained in:
pacmandoh 2024-02-05 01:10:33 +08:00 committed by Hk-Gosuto
parent f76e47931f
commit 666c80456a
5 changed files with 17 additions and 3 deletions

View File

@ -65,12 +65,11 @@
.sidebar-search-bar { .sidebar-search-bar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-bottom: 10px; margin-bottom: 15px;
.sidebar-search-bar-input { .sidebar-search-bar-input {
position: relative; position: relative;
width: 100%; width: 100%;
margin-bottom: 5px;
.search-icon { .search-icon {
position: absolute; position: absolute;
@ -90,12 +89,17 @@
height: 16px; height: 16px;
} }
input { .search-input {
text-align: left; text-align: left;
max-width: 100%; max-width: 100%;
width: inherit; width: inherit;
padding-left: 35px; padding-left: 35px;
padding-right: 35px; padding-right: 35px;
outline: none;
}
.search-input:focus {
border: 1px solid var(--primary);
} }
} }

View File

@ -21,6 +21,11 @@
flex-grow: 1; flex-grow: 1;
max-width: 100%; max-width: 100%;
min-width: 0; min-width: 0;
outline: none;
}
.search-bar:focus {
border: 1px solid var(--primary);
} }
.plugin-filter-lang { .plugin-filter-lang {

View File

@ -16,6 +16,7 @@ import CloseIcon from "../icons/close.svg";
import { Markdown } from "./markdown"; import { Markdown } from "./markdown";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { Path } from "@/app/constant"; import { Path } from "@/app/constant";
import Locale from "../locales";
interface SearchResult { interface SearchResult {
sessionId: string; sessionId: string;
@ -209,12 +210,14 @@ function SearchBarComponent(
<div className={styles["sidebar-search-bar-input"]}> <div className={styles["sidebar-search-bar-input"]}>
<SearchIcon className={styles["search-icon"]} /> <SearchIcon className={styles["search-icon"]} />
<input <input
className={styles["search-input"]}
ref={inputRef} ref={inputRef}
type="text" type="text"
value={input} value={input}
onChange={(e) => handleChange(e.target.value)} onChange={(e) => handleChange(e.target.value)}
onFocus={handleFocus} onFocus={handleFocus}
onBlur={handleBlur} onBlur={handleBlur}
placeholder={Locale.Home.Search}
/> />
{input.trim().length > 0 && ( {input.trim().length > 0 && (
<IconButton <IconButton

View File

@ -125,6 +125,7 @@ const cn = {
DeleteChat: "确认删除选中的对话?", DeleteChat: "确认删除选中的对话?",
DeleteToast: "已删除会话", DeleteToast: "已删除会话",
Revert: "撤销", Revert: "撤销",
Search: "搜索聊天",
}, },
Settings: { Settings: {
Title: "设置", Title: "设置",

View File

@ -128,6 +128,7 @@ const en: LocaleType = {
DeleteChat: "Confirm to delete the selected conversation?", DeleteChat: "Confirm to delete the selected conversation?",
DeleteToast: "Chat Deleted", DeleteToast: "Chat Deleted",
Revert: "Revert", Revert: "Revert",
Search: "Search Chat",
}, },
Settings: { Settings: {
Title: "Settings", Title: "Settings",