Add button to clear filters
This commit is contained in:
parent
e844f332bc
commit
53ee8eb368
@ -16,6 +16,7 @@ Various Codicon icons have been used in this extension. Check [here](https://cod
|
|||||||
- `kanbn-header-name`
|
- `kanbn-header-name`
|
||||||
- `kanbn-filter`
|
- `kanbn-filter`
|
||||||
- `kanbn-filter-input`
|
- `kanbn-filter-input`
|
||||||
|
- `kanbn-clear-filter-button`
|
||||||
- `kanbn-filter-button`
|
- `kanbn-filter-button`
|
||||||
- `kanbn-header-description`
|
- `kanbn-header-description`
|
||||||
- `kanbn-board`
|
- `kanbn-board`
|
||||||
|
@ -144,6 +144,12 @@ const Board = ({ name, description, columns, hiddenColumns, startedColumns, comp
|
|||||||
const [, setColumns] = useState(columns);
|
const [, setColumns] = useState(columns);
|
||||||
const [taskFilter, setTaskFilter] = useState('');
|
const [taskFilter, setTaskFilter] = useState('');
|
||||||
|
|
||||||
|
// Called when the clear filter button is clicked
|
||||||
|
const clearFilters = e => {
|
||||||
|
(document.querySelector('.kanbn-filter-input') as HTMLInputElement).value = '';
|
||||||
|
filterTasks(e);
|
||||||
|
};
|
||||||
|
|
||||||
// Called when the filter form is submitted
|
// Called when the filter form is submitted
|
||||||
const filterTasks = e => {
|
const filterTasks = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -161,10 +167,22 @@ const Board = ({ name, description, columns, hiddenColumns, startedColumns, comp
|
|||||||
className="kanbn-filter-input"
|
className="kanbn-filter-input"
|
||||||
placeholder="Filter tasks"
|
placeholder="Filter tasks"
|
||||||
/>
|
/>
|
||||||
|
{
|
||||||
|
taskFilter &&
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="kanbn-clear-filter-button"
|
||||||
|
onClick={clearFilters}
|
||||||
|
title="Clear task filters"
|
||||||
|
>
|
||||||
|
<i className="codicon codicon-clear-all"></i>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="kanbn-filter-button"
|
className="kanbn-filter-button"
|
||||||
onClick={filterTasks}
|
onClick={filterTasks}
|
||||||
|
title="Filter tasks"
|
||||||
>
|
>
|
||||||
<i className="codicon codicon-filter"></i>
|
<i className="codicon codicon-filter"></i>
|
||||||
</button>
|
</button>
|
||||||
|
@ -26,6 +26,7 @@ body.vscode-high-contrast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.kanbn-filter {
|
.kanbn-filter {
|
||||||
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
@ -43,6 +44,17 @@ body.vscode-high-contrast {
|
|||||||
border-color: var(--vscode-input-border);
|
border-color: var(--vscode-input-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.kanbn-clear-filter-button {
|
||||||
|
position: absolute;
|
||||||
|
right: 45px;
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--vscode-button-foreground);
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 9px 1em;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
.kanbn-filter-button {
|
.kanbn-filter-button {
|
||||||
outline: none;
|
outline: none;
|
||||||
border: none;
|
border: none;
|
||||||
@ -52,12 +64,17 @@ body.vscode-high-contrast {
|
|||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.kanbn-clear-filter-button .codicon,
|
||||||
.kanbn-filter-button .codicon {
|
.kanbn-filter-button .codicon {
|
||||||
font-size: 11px !important;
|
font-size: 12px !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.kanbn-clear-filter-button:hover, .kanbn-clear-filter-button:focus {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.kanbn-filter-button:hover, .kanbn-filter-button:focus {
|
.kanbn-filter-button:hover, .kanbn-filter-button:focus {
|
||||||
background-color: var(--vscode-button-hoverBackground);
|
background-color: var(--vscode-button-hoverBackground);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user