Skip to content

Commit

Permalink
fix(app): navbar highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Oct 8, 2023
1 parent 3bd6b07 commit ed15952
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/app/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const timestamp =
Astro.props.timestamp ??
new Date((await env?.animegarden.get('state/refresh-timestamp')) ?? new Date());
const hasTypeSearch = search.has('type');
const hasFansubSearch = search.has('fansubId');
const active = hasFansubSearch ? 'fansub' : hasTypeSearch ? 'type' : '';
function generateFeed(params: URLSearchParams) {
const filter = parseSearchURL(params);
Expand Down Expand Up @@ -78,10 +80,10 @@ function followSearch(params: Record<string, string>) {
<a
href="/resources/1"
class="header-item block"
x-active={url.startsWith('/resources/') && !search.has('type') && !search.has('fansub')}
x-active={url.startsWith('/resources/') && active === ''}
>所有资源</a
>
<div class="header-item cursor-pointer" x-active={search.has('type')}>
<div class="header-item cursor-pointer" x-active={active === 'type'}>
<Dropdown>
<span>类型</span>
<div slot="dropdown" class="mt4">
Expand All @@ -102,7 +104,7 @@ function followSearch(params: Record<string, string>) {
</div>
</Dropdown>
</div>
<div class="header-item cursor-pointer" x-active={search.has('fansub')}>
<div class="header-item cursor-pointer" x-active={active === 'fansub'}>
<Dropdown>
<span>字幕组</span>
<div slot="dropdown" class="mt4">
Expand Down

0 comments on commit ed15952

Please sign in to comment.