fix: simplify desktop search panel
All checks were successful
Deploy to Frontend Servers / deploy (push) Successful in 25s
All checks were successful
Deploy to Frontend Servers / deploy (push) Successful in 25s
This commit is contained in:
@@ -361,41 +361,45 @@ export function SearchPanel({
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
<section className={cleanQuery ? "mt-6" : showInput ? "mt-5" : "mt-0"}>
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<h2 className="border-l-4 border-ark-gold pl-3 text-base font-bold text-neutral-100">
|
||||
{t("currentTags")}
|
||||
</h2>
|
||||
</div>
|
||||
{!cleanQuery ? (
|
||||
<section className={showInput ? "mt-5" : "mt-0"}>
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<h2 className="border-l-4 border-ark-gold pl-3 text-base font-bold text-neutral-100">
|
||||
{t("currentTags")}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
{isTagLoading ? (
|
||||
<div className="py-3 text-sm text-neutral-500">{t("loading")}</div>
|
||||
) : tags.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{tags.map((tag) => {
|
||||
const active = selectedTag === tag.name;
|
||||
return (
|
||||
<button
|
||||
key={tag.name}
|
||||
type="button"
|
||||
onClick={() => showTagPosts(tag.name)}
|
||||
className={`rounded-full border px-3 py-1.5 text-xs font-bold transition ${
|
||||
active
|
||||
? "border-ark-gold bg-ark-gold/15 text-ark-gold"
|
||||
: "border-white/10 bg-[#232329] text-neutral-200 hover:border-ark-gold/60 hover:text-ark-gold"
|
||||
}`}
|
||||
>
|
||||
#{tag.name}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="py-3 text-sm text-neutral-500">
|
||||
{t("noTagsAvailable")}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
{isTagLoading ? (
|
||||
<div className="py-3 text-sm text-neutral-500">
|
||||
{t("loading")}
|
||||
</div>
|
||||
) : tags.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{tags.map((tag) => {
|
||||
const active = selectedTag === tag.name;
|
||||
return (
|
||||
<button
|
||||
key={tag.name}
|
||||
type="button"
|
||||
onClick={() => showTagPosts(tag.name)}
|
||||
className={`rounded-full border px-3 py-1.5 text-xs font-bold transition ${
|
||||
active
|
||||
? "border-ark-gold bg-ark-gold/15 text-ark-gold"
|
||||
: "border-white/10 bg-[#232329] text-neutral-200 hover:border-ark-gold/60 hover:text-ark-gold"
|
||||
}`}
|
||||
>
|
||||
#{tag.name}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="py-3 text-sm text-neutral-500">
|
||||
{t("noTagsAvailable")}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
{selectedTag ? (
|
||||
<section className="mt-6">
|
||||
|
||||
@@ -613,28 +613,26 @@ export function PublicLayout() {
|
||||
<div className="flex min-w-0 flex-1 items-center justify-end gap-2 min-[1100px]:flex-none">
|
||||
<div
|
||||
ref={desktopSearchRef}
|
||||
className="hidden h-10 min-w-0 flex-1 items-center gap-2 rounded-full border border-ark-line bg-[#1a1b20] py-2 pl-3 pr-3 shadow-inner md:flex min-[1100px]:w-44 min-[1100px]:flex-none lg:pr-4 xl:w-52"
|
||||
className={`hidden md:block ${
|
||||
desktopSearchOpen ? "pointer-events-none opacity-0" : ""
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (q.trim()) goSearch();
|
||||
else setDesktopSearchOpen((value) => !value);
|
||||
}}
|
||||
className="shrink-0 rounded-full p-1 text-[#c6c7cf] transition hover:bg-white/5 hover:text-ark-gold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ark-gold/60"
|
||||
aria-label={t("searchNow")}
|
||||
>
|
||||
<SearchIcon size={16} />
|
||||
</button>
|
||||
<input
|
||||
value={q}
|
||||
onFocus={() => setDesktopSearchOpen(true)}
|
||||
onClick={() => setDesktopSearchOpen(true)}
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && goSearch()}
|
||||
placeholder={t("searchPlaceholder")}
|
||||
className="min-w-0 flex-1 rounded-md bg-transparent text-sm text-neutral-200 outline-none placeholder:text-[#777985] focus-visible:ring-2 focus-visible:ring-ark-gold/60 focus-visible:ring-offset-2 focus-visible:ring-offset-[#1a1b20]"
|
||||
/>
|
||||
className="flex h-10 min-w-0 flex-1 items-center gap-2 rounded-full border border-ark-line bg-[#1a1b20] py-2 pl-3 pr-3 text-left shadow-inner outline-none transition hover:border-ark-gold/50 focus-visible:ring-2 focus-visible:ring-ark-gold/60 focus-visible:ring-offset-2 focus-visible:ring-offset-ark-bg min-[1100px]:w-44 min-[1100px]:flex-none lg:pr-4 xl:w-52"
|
||||
aria-label={t("searchNow")}
|
||||
aria-expanded={desktopSearchOpen}
|
||||
>
|
||||
<SearchIcon size={16} className="shrink-0 text-[#c6c7cf]" />
|
||||
<span
|
||||
className={`min-w-0 flex-1 truncate text-sm ${
|
||||
q.trim() ? "text-neutral-200" : "text-[#777985]"
|
||||
}`}
|
||||
>
|
||||
{q.trim() || t("searchPlaceholder")}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<LanguageDropdown
|
||||
lang={lang}
|
||||
@@ -736,7 +734,6 @@ export function PublicLayout() {
|
||||
onSearch={goSearch}
|
||||
onResultClick={() => setDesktopSearchOpen(false)}
|
||||
variant="desktop"
|
||||
showInput={false}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user