Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: wrong open/close state #269

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions app/components/DocsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,6 @@
[menuConfig]
)

const [isSearchboxOpen, setIsSearchboxOpen] = React.useState(false)

const docsMatch = matches.find((d) => d.pathname.includes('/docs'))

const relativePathname = lastMatch.pathname.replace(
Expand Down Expand Up @@ -491,10 +489,7 @@
onSelect={versionConfig.onSelect}
/>
</div>
<ClientOnlySearchButton
{...searchButtonParams}
onClick={() => setIsSearchboxOpen(true)}
>
<ClientOnlySearchButton {...searchButtonParams}>
Search
</ClientOnlySearchButton>
{menuItems}
Expand Down Expand Up @@ -554,8 +549,6 @@
} as any,
}}
facetProperty={undefined}
open={isSearchboxOpen}
onSearchboxClosed={() => setIsSearchboxOpen(false)}
/>
</div>
{smallMenu}
Expand Down Expand Up @@ -635,7 +628,7 @@
key={partner.name}
className="overflow-hidden hover:bg-gray-500/10 dark:hover:bg-gray-500/10 transition-colors"
>
<a

Check warning on line 631 in app/components/DocsLayout.tsx

View workflow job for this annotation

GitHub Actions / PR

Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations
href={partner.href}
target="_blank"
className="px-4 flex items-center justify-center cursor-pointer"
Expand Down
13 changes: 2 additions & 11 deletions app/routes/_libraries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ function LibrariesLayout() {

const [mounted, setMounted] = React.useState(false)

const [onSearchboxOpen, setOnSearchboxOpen] = React.useState(false)

React.useEffect(() => {
setMounted(true)
}, [])
Expand Down Expand Up @@ -257,10 +255,7 @@ function LibrariesLayout() {
{logo}
</div>
<div className="p-2">
<ClientOnlySearchButton
{...searchButtonParams}
onClick={() => setOnSearchboxOpen(true)}
>
<ClientOnlySearchButton {...searchButtonParams}>
Search
</ClientOnlySearchButton>
</div>
Expand All @@ -285,11 +280,7 @@ function LibrariesLayout() {
</div>
{mounted ? (
<div className="fixed z-50">
<OramaSearchBox
{...searchBoxParams}
open={onSearchboxOpen}
onSearchboxClosed={() => setOnSearchboxOpen(false)}
/>
<OramaSearchBox {...searchBoxParams} />
</div>
) : null}
</div>
Expand Down
Loading