Skip to content
Commits on Source (8)
......@@ -2,4 +2,7 @@
/node_modules/
yarn-error.log
.env
.svelte-kit
\ No newline at end of file
.svelte-kit
/src/node_modules
/build
__sapper__
\ No newline at end of file
{
"name": "laboite-blog-front",
"description": "laboite blog service frontend",
"version": "1.9.0-testing.1",
"version": "1.9.0-testing.2",
"license": "EUPL-1.2",
"author": "EOLE/PCLL <team@eole.education> - DINUM",
"type": "module",
......
......@@ -12,11 +12,18 @@
const open = () => (opened = true);
const close = () => (opened = false);
const handleKeydown = (event) => {
if (event.key === 'Enter' && search !== '') {
event.preventDefault();
onChange(search)
search = ''
}
};
</script>
<div class="dropdown is-active" on:mouseleave={close} on:mouseenter={open}>
<div class="dropdown-trigger">
<input bind:value={search} class="input" type="text" />
<input bind:value={search} class="input" type="text" on:keydown={handleKeydown}/>
</div>
{#if opened}
<div class="dropdown-menu" role="menu" transition:slide>
......@@ -27,6 +34,7 @@
class="dropdown-item"
on:click={() => {
onChange(item.value);
search = ''
}}
>
{item.label}
......
......@@ -16,9 +16,11 @@
const dispatch = createEventDispatcher();
function addTag(tag) {
dispatch('addTag', {
tag: tag,
});
if (!queryTags.includes(tag)) {
dispatch('addTag', {
tag: tag,
});
}
}
let opened = false;
......@@ -61,7 +63,7 @@
>
{#if $page.url.searchParams.get('tags')}
{' - '}
<a rel="prefetch" href={resetUrl()}>
<a href={resetUrl()}>
{$_('components.TagsFilters.reset')}
</a>
{/if}
......
......@@ -25,15 +25,18 @@
}
function addTag(event) {
const tagsArray = [...queryTags];
tagsArray.push(event.detail.tag);
const tagsString = tagsArray.join(',');
const url = `${data.path}?${toQuery({
...data.query,
page: 1,
tags: tagsString,
})}`;
goto(url);
const tagToAdd = event.detail.tag
if (!queryTags.includes(tagToAdd)){
const tagsArray = [...queryTags];
tagsArray.push(tagToAdd);
const tagsString = tagsArray.join(',');
const url = `${data.path}?${toQuery({
...data.query,
page: 1,
tags: tagsString,
})}`;
goto(url);
}
}
$: tagSearch = tagSearch;
......@@ -87,15 +90,13 @@
{/if}
</div>
<div class="column is-full">
{#if !$navigating}
<TagsFilter
query={data.query}
path={data.path}
tagsList={data.tagsList}
on:addTag={addTag}
{queryTags}
/>
{/if}
<TagsFilter
query={data.query}
path={data.path}
tagsList={data.tagsList}
on:addTag={addTag}
{queryTags}
/>
</div>
</div>
......