Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-socio-fiscal-ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
leximpact-socio-fiscal-ui
Merge requests
!210
Début du travail sur la nouvelle page d'accueil/d'atterrissage du simulateur
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Début du travail sur la nouvelle page d'accueil/d'atterrissage du simulateur
welcome_page
into
master
Overview
2
Commits
77
Pipelines
68
Changes
3
Merged
Début du travail sur la nouvelle page d'accueil/d'atterrissage du simulateur
Toufic Batache
requested to merge
welcome_page
into
master
Mar 25, 2024
Overview
2
Commits
77
Pipelines
68
Changes
3
Styles des liens unifiés en CSS ?
Dans
suggestions
:
aides_logement
ou
aide_logement
?
Edited
May 22, 2024
by
Toufic Batache
0
0
Merge request reports
Viewing commit
1e9e83b9
Show latest version
3 files
+
104
−
15
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
1e9e83b9
Better search
· 1e9e83b9
Toufic Batache
authored
Apr 3, 2024
src/lib/components/search/WelcomeSearch.svelte
+
59
−
13
View file @ 1e9e83b9
Edit in single-file editor
Open in Web IDE
Show full file
<script
lang=
"ts"
>
export
let
isSearchActive
:
boolean
export
let
searchQuery
:
string
import
type
{
SearchResult
}
from
"
minisearch
"
import
{
browser
}
from
"
$app/environment
"
import
WithLinkedVariablesSearchWorker
from
"
$lib/search/search_worker_variables_with_linked?worker
"
let
inProgress
=
false
let
pendingQuery
:
string
|
null
=
null
let
query
=
""
let
results
:
SearchResult
[]
=
[]
let
worker
:
Worker
|
undefined
=
undefined
if
(
browser
)
{
worker
=
new
WithLinkedVariablesSearchWorker
()
worker
.
onmessage
=
function
(
event
)
{
results
=
event
.
data
// If there's no pending query, we're done!
if
(
pendingQuery
===
null
)
{
inProgress
=
false
}
else
{
// If we were waiting for results before searching again, run search
worker
?.
postMessage
(
pendingQuery
)
pendingQuery
=
null
}
}
}
$
:
if
(
query
.
length
>
0
)
{
search
(
query
)
}
else
{
results
=
[]
}
function
search
(
query
:
string
)
{
if
(
worker
===
undefined
)
return
// If search is already running, save the query inside the
// pending query variable, awaiting results before searching again
if
(
inProgress
)
{
pendingQuery
=
query
return
}
inProgress
=
true
worker
.
postMessage
(
query
)
}
</script>
<div
class=
"
flex gap-1.5 w-full
overflow-hidden rounded-t-md border-2 border-neutral-200 border-b-4 border-b-[#A6A00C] bg-gray-100"
class=
"
w-full flex items-center gap-1.5
overflow-hidden rounded-t-md border-2 border-neutral-200 border-b-4 border-b-[#A6A00C] bg-gray-100"
>
<iconify-icon
class=
"ml-4 self-center p-1 text-xl text-black"
@@ -16,16 +60,18 @@
id=
"navbar_search"
placeholder=
"impôt sur le revenu, CSG, ..."
type=
"search"
bind:value=
{
searchQ
uery
}
bind:value=
{
q
uery
}
/>
{
#if
isSearchActive
}
<iconify-icon
class=
"md:mx-1 cursor-pointer self-center p-1 text-black"
icon=
"ri-close-line"
width=
"20"
height=
"20"
on:click=
{
()
=>
(
searchQuery
=
""
)
}
on:keyup
/>
{
#if
query
.
length
>
0
}
<button
class=
"md:mr-2.5 p-2 rounded-full hover:bg-black hover:bg-opacity-10 active:bg-black active:bg-opacity-20 transition-all duration-200 ease-out-back"
on:click=
{
()
=>
(
query
=
""
)
}
>
<iconify-icon
class=
"block text-xl"
icon=
"ri-close-line"
/>
</button>
{
/if
}
</div>
{
#if
query
.
length
>
0
}
<slot
{
query
}
{
results
}
/>
{
/if
}
Loading