change board filter icon when filter active
This commit is contained in:
@@ -20,6 +20,14 @@ export function BoardPage(
|
||||
) {
|
||||
boardViewModel.loadData();
|
||||
|
||||
const filterIcon = React.createProxyState(
|
||||
[boardViewModel.isFilterActive],
|
||||
() =>
|
||||
boardViewModel.isFilterActive.value
|
||||
? "filter_alt"
|
||||
: "filter_alt_off",
|
||||
);
|
||||
|
||||
// main content
|
||||
const mainContent = React.createProxyState(
|
||||
[boardViewModel.selectedPage],
|
||||
@@ -135,7 +143,10 @@ export function BoardPage(
|
||||
}
|
||||
on:click={boardViewModel.showFilterModal}
|
||||
>
|
||||
<span class="icon">filter_alt</span>
|
||||
<span
|
||||
class="icon"
|
||||
subscribe:innerText={filterIcon}
|
||||
></span>
|
||||
</button>
|
||||
<button
|
||||
class="ghost"
|
||||
|
||||
@@ -32,6 +32,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
searchViewModel: SearchViewModel<TaskViewModel>;
|
||||
filteredTaskViewModels: React.ListState<TaskViewModel> =
|
||||
new React.ListState();
|
||||
isFilterActive: React.State<boolean>;
|
||||
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
@@ -289,6 +290,11 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this.handleNewSearch(newQuery);
|
||||
});
|
||||
this.restoreSearch();
|
||||
|
||||
this.isFilterActive = React.createProxyState(
|
||||
[this.searchViewModel.appliedQuery],
|
||||
() => this.searchViewModel.appliedQuery.value != "",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user