Skip to content

Commit

Permalink
add hover style for search
Browse files Browse the repository at this point in the history
  • Loading branch information
zzq0826 committed Aug 8, 2023
1 parent 5cdea5f commit a2aeca3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/components/Header/Search/Search.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
box-sizing: content-box;
}

.hitWrapper {
max-height: 40vh;
overflow: overlay;
}

.hitWrapper ol {
list-style: none;
}
Expand All @@ -155,11 +160,12 @@

.hitList li {
list-style: none;
cursor: pointer;
@apply pl-2;
}

.hitList li:hover {
@apply bg-background-secondary;
.hitList li:hover * {
color: var(--orange-500);
}

.hitList li a {
Expand Down Expand Up @@ -217,6 +223,11 @@
@apply mt-0;
}

.hitWrapper {
max-height: calc(80vh - 100px);
overflow: scroll;
}

.hitList li {
@apply pl-0;
}
Expand Down
12 changes: 11 additions & 1 deletion src/components/Header/Search/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useCallback } from "react"
import React, { useState, useCallback, useEffect } from "react"
import styles from "./Search.module.css"

import { useKeyPress } from "~/hooks/useKeyPress"
Expand All @@ -11,6 +11,16 @@ export default function Search() {
setIsOpen(true)
}, [setIsOpen])


useEffect(() => {
const body = document.getElementsByTagName("body")[0]
if (isOpen) {
body.classList.add("mobile-sidebar-toggle")
} else {
body.classList.remove("mobile-sidebar-toggle")
}
}, [isOpen])

const onClose = useCallback(() => {
setTimeout(() => {
setIsOpen(false)
Expand Down

0 comments on commit a2aeca3

Please sign in to comment.