Skip to content

Commit

Permalink
Merge branch 'sepolia-launch-fixes' of github.com:scroll-tech/scroll-…
Browse files Browse the repository at this point in the history
…documentation into sepolia-launch-fixes
  • Loading branch information
dghelm committed Aug 8, 2023
2 parents 84cf25e + 8c25147 commit c4296ab
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 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
11 changes: 10 additions & 1 deletion src/components/Header/Search/SearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ function EmptyQueryBoundary({ children, fallback }) {
return children
}

function transformPath(path) {
path = path.replace('src/content/docs', '');

path = path.substring(0, path.lastIndexOf('.')) || path;

return path;
}


function NoResultsBoundary({ children }) {
const { results } = useInstantSearch()

Expand Down Expand Up @@ -118,7 +127,7 @@ function CustomHits({ title, hitClassName, ...props }: UseHitsProps & { title: s
<li style={{ borderRadius: "var(--border-radius-primary)" }}>
<a
// style={{ padding: "var(--space-1x) var(--space-2x)" }}
href={hit.url}
href={hit.url && transformPath(hit.url)}
className={clsx(styles.hit, hitClassName, "paragraph-200")}
dangerouslySetInnerHTML={{
__html: hit._highlightResult.title.value,
Expand Down
1 change: 1 addition & 0 deletions src/pages/[lang]/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export async function getStaticPaths() {
allPaths.push({ params: { lang, slug: slug || undefined } })
}
}
const paths = allPaths.map((path) => {
let page = pages.find((page) => {
const [pageLang, ...pageSlug] = page.slug.split("/")
Expand Down

0 comments on commit c4296ab

Please sign in to comment.