Skip to content

feat(GlobalSearch): remove duplicated code #1054

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 3 additions & 21 deletions frontend/islands/GlobalSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ export function GlobalSearch(
jumbo ? "!px-3.5" : "!px-1.5"
}`}
>
<div class="whitespace-nowrap overflow-hidden !text-transparent px-0.5">
<div
class={`search-input !bg-transparent !border-transparent select-none pointer-events-none inset-0 absolute ${sizeClasses} `}
>
<div ref={inputOverlayContentRef}>
{tokenizeFilter(search.value).map((token, i, arr) => (
<span>
Expand All @@ -312,26 +314,6 @@ export function GlobalSearch(
</div>
</div>
)}
{kind === "packages" && (
<div
class={`search-input !bg-transparent !border-transparent select-none pointer-events-none inset-0 absolute ${sizeClasses} `}
>
<div class="whitespace-nowrap overflow-hidden">
<div ref={inputOverlayContent2Ref}>
{tokenizeFilter(search.value).map((token, i, arr) => (
<span>
<span
class={token.kind === "text" ? "" : "text-blue-500"}
>
{token.raw}
</span>
{((arr.length - 1) !== i) && " "}
</span>
))}
</div>
</div>
</div>
)}
</div>

<button
Expand Down
3 changes: 2 additions & 1 deletion frontend/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@
}

.search-input-tag {
@apply bg-blue-300/40 rounded-sm px-0.5 -mx-0.5 dark:bg-blue-900/40;
@apply text-blue-500 bg-blue-300/40 rounded-sm px-0.5 -mx-0.5
dark:bg-blue-900/40;
}

.select {
Expand Down
Loading