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

feat: [sveltekit-pod] Issues Search: inline filters (open/closed) #973

Merged
merged 7 commits into from
Nov 29, 2022
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
158 changes: 0 additions & 158 deletions svelte-kit-scss/src/lib/components/IssueHeader/IssueHeader.svelte

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,31 +1,62 @@
<script lang="ts">
import { goto, prefetch } from '$app/navigation';
import { goto } from '$app/navigation';
import DropdownMenuSelect from '$lib/components/shared/Dropdown/DropdownMenuSelect/DropdownMenuSelect.svelte';
import DropdownFilterTextButton from './DropdownFilterTextButton.svelte';
import type { NavigationFilterOption } from './models';
import IssueStateFilter from './IssueStateFilter.svelte';

export let sortFilters: NavigationFilterOption[];
export let stateFilters: NavigationFilterOption[];
export let milestoneFilters: NavigationFilterOption[];

const handleFilterSelect = async (option: NavigationFilterOption): Promise<void> => {
if (option.active) {
const handleFilterSelect = async (
option: NavigationFilterOption,
optional = false
): Promise<void> => {
if (!optional && option.active) {
return;
}
await prefetch(option.href);
await goto(option.href);
};
</script>

<div class="issue-search-controls">
<DropdownMenuSelect
description="Sort by"
options={sortFilters}
labelAccessor={(x) => x.label}
checkedPredicate={(x) => x.active}
on:select={async ({ detail }) => await handleFilterSelect(detail)}
>
<DropdownFilterTextButton text="Sort" />
</DropdownMenuSelect>
<div class="primary">
<IssueStateFilter options={stateFilters} />
</div>
<div class="secondary">
<DropdownMenuSelect
description="Filter by milestone"
options={milestoneFilters}
labelAccessor={(x) => x.label}
checkedPredicate={(x) => x.active}
on:select={async ({ detail }) => await handleFilterSelect(detail, true)}
direction="left"
>
<DropdownFilterTextButton text="Milestone" />
</DropdownMenuSelect>
<DropdownMenuSelect
description="Sort by"
options={sortFilters}
labelAccessor={(x) => x.label}
checkedPredicate={(x) => x.active}
on:select={async ({ detail }) => await handleFilterSelect(detail)}
direction="left"
>
<DropdownFilterTextButton text="Sort" />
</DropdownMenuSelect>
</div>
</div>

<style lang="scss">
.issue-search-controls {
display: flex;
.primary {
flex: 1;
}
.secondary {
display: flex;
gap: 1em;
}
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script lang="ts">
import IssueStateIcon from '../IssueSearchListItem/IssueStateIcon.svelte';
import type { NavigationFilterOption } from './models';
import { IssueState } from '$lib/interfaces';

export let options: NavigationFilterOption[];
$: [openFilter, closedFilter] = options;
</script>

<div class="issue-state-filters" data-sveltekit-preload-data="off">
<a class="link" href={openFilter.href} class:active={openFilter.active}
><IssueStateIcon state={IssueState.Open} /><span>{openFilter.label}</span></a
>
<a class="link" href={closedFilter.href} class:active={closedFilter.active}
><IssueStateIcon state={IssueState.Closed} /><span>{closedFilter.label}</span></a
>
</div>

<style lang="scss">
.issue-state-filters {
display: flex;
gap: 1em;
.link {
text-decoration: none;
opacity: 0.7;
color: inherit;
display: flex;
align-items: center;
gap: 0.25em;
&.active {
font-weight: 600;
}
&:hover,
&.active {
opacity: 1;
}
}
}
</style>
32 changes: 0 additions & 32 deletions svelte-kit-scss/src/lib/components/IssuesList/IssuesList.svelte

This file was deleted.

Loading