增加antdesight优化样式

This commit is contained in:
yuruo
2024-06-09 15:57:39 +08:00
parent d802650bf3
commit 861884f9f4
7 changed files with 964 additions and 7 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,7 @@
"@electron-toolkit/preload": "^3.0.0",
"@electron-toolkit/utils": "^3.0.0",
"@icon-park/react": "^1.4.2",
"antd": "^5.18.0",
"electron-updater": "^6.1.7",
"zustand": "^4.5.2"
},

View File

@@ -9,7 +9,7 @@ export const registerShortCut = (win: BrowserWindow) => {
ipcMain.handle("shortCut", (_event: IpcMainInvokeEvent, type: 'search', shortCut: string) => {
// react 严格模式会执行两次,可能会导致快捷键重复注册,这里在注册前会删除旧快捷键,也用户注册过快捷键想修改成其他快捷键
if (config.search) globalShortcut.unregister(config.search)
// if (config.search) globalShortcut.unregister(config.search)
config.search = shortCut
switch(type){
case 'search':

View File

@@ -10,9 +10,11 @@ function App(): JSX.Element {
shortCut.register("search", "CommandOrControl+n")
return (
<CodeProvider>
<main className="relative">
<Error/>
<Search />
<Result />
</main>
</CodeProvider>
)
}

View File

@@ -3,7 +3,7 @@ body{
}
*{
opacity: 0.99;
opacity: 0.995;
}

View File

@@ -1,4 +1,5 @@
import { useStore } from "@renderer/store/useStore"
import { Alert } from "antd"
import { useEffect } from "react"
function Error(){
@@ -9,7 +10,10 @@ function Error(){
return () => clearTimeout(id)
}, [error])
if (!error) return <></>
return <><div className="bg-red-600 text-white">{error}</div></>
return (<main className="absolute top-0 z-10 w-full">
<Alert message={error} type="error" showIcon />
</main>)
}
export default Error

View File

@@ -1,6 +1,7 @@
import { useStore } from "@renderer/store/useStore"
import useSearch from "@renderer/hooks/useSearch"
import { SettingOne } from "@icon-park/react"
import { Input } from "antd"
export default function Search(): JSX.Element {
const search = useStore((state)=>state.search)
const {handleSearch} = useSearch()
@@ -17,10 +18,17 @@ export default function Search(): JSX.Element {
console.log("点击了设置")
alert("设置")}}
/>
<input
<Input
placeholder="请输入内容"
value={search}
onChange={handleSearch}
className="w-full outline-none text-2xl text-slate-600 bg-slate-200" />
autoFocus
/>
{/* <input
value={search}
onChange={handleSearch}
className="w-full outline-none text-2xl text-slate-600 bg-slate-200"
autoFocus/> */}
</section>
<section className="text-center text-slate-600 text-xs mt-2">autoMate</section>
</div>