Skip to content

Commit 348e109

Browse files
Daemon-25dwightjlaelmanaa
authored
fix aiSearchBar component (#1858)
* fix aiSearchBar component * Update SearchButton.tsx navigator checked when the component loaded on browser side --------- Co-authored-by: Dwight Lyle <dwightjl@gmail.com> Co-authored-by: Amine E <aelmanaa@users.noreply.github.com>
1 parent 7125c8e commit 348e109

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/Header/aiSearch/SearchButton.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { clsx } from "~/lib"
22
import styles from "./searchButton.module.css"
3+
import { useEffect, useState } from "react"
34

45
const searchIcon = (
56
<svg
@@ -25,6 +26,12 @@ const searchIcon = (
2526
)
2627

2728
export const SearchButton = ({ variant }: { variant: "default" | "bottomBar" }) => {
29+
const [isMac, setIsMac] = useState(false)
30+
useEffect(() => {
31+
const checkIsMac = typeof navigator !== "undefined" ? navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 : false
32+
setIsMac(checkIsMac)
33+
}, [])
34+
2835
return variant === "default" ? (
2936
<button className={clsx(styles.default, "search-widget-trigger")}>
3037
<svg
@@ -48,7 +55,7 @@ export const SearchButton = ({ variant }: { variant: "default" | "bottomBar" })
4855
</defs>
4956
</svg>
5057
<span className={styles.text}>Search Chainlink Docs</span>
51-
<div className={styles.shortcut}>K</div>
58+
<div className={styles.shortcut}>{isMac ? "⌘" : "Ctrl+"}K</div>
5259
</button>
5360
) : (
5461
<button className={clsx(styles.bottomBar, "search-widget-trigger")}>

0 commit comments

Comments
 (0)