Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
monnaie-libre-fr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Léo El Amri
monnaie-libre-fr
Commits
117beca3
Commit
117beca3
authored
3 years ago
by
Emmanuel Salomon
Browse files
Options
Downloads
Patches
Plain Diff
perf: move map to component and lazy load with intersection observer
parent
8930fb86
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/home/HomeMap.vue
+70
-0
70 additions, 0 deletions
components/home/HomeMap.vue
pages/index.vue
+1
-37
1 addition, 37 deletions
pages/index.vue
with
71 additions
and
37 deletions
components/home/HomeMap.vue
0 → 100644
+
70
−
0
View file @
117beca3
<
template
>
<section
id=
"map"
>
<div
class=
"container flex items-end mb-3"
>
<FaviconMap
class=
"w-12 h-12 mr-3 fill-current dark:text-gray-100"
/>
<a
href=
"https://carte.monnaie-libre.fr"
target=
"_blank"
class=
"
group
bg-clip-text bg-gradient-to-r
font-extrabold
from-purple-800
hover:underline
text-4xl text-transparent
to-blue-600
uppercase
"
rel=
"noopener noreferrer"
>
Carte
<fa
icon=
"external-link-alt"
class=
"w-3 ml-1.5 text-gray-500 opacity-0 group-hover:opacity-75"
/>
</a>
</div>
<iframe
:src=
"intersected ? 'https://carte.monnaie-libre.fr/?zoom=5' : null"
class=
"w-screen bg-gray-200"
style=
"height: 50vh; min-height: 600px"
title=
"Carte monnaie-libre"
/>
</section>
</
template
>
<
script
>
import
FaviconMap
from
'
~/static/img/favicon-map-g1.svg?inline
'
export
default
{
components
:
{
FaviconMap
,
},
data
()
{
return
{
observer
:
null
,
intersected
:
false
,
}
},
mounted
()
{
this
.
observer
=
new
IntersectionObserver
(
(
entries
)
=>
{
const
item
=
entries
[
0
]
if
(
item
.
isIntersecting
)
{
this
.
intersected
=
true
this
.
observer
.
disconnect
()
}
},
{
rootMargin
:
'
500px
'
,
}
)
this
.
observer
.
observe
(
this
.
$el
)
},
destroyed
()
{
this
.
observer
.
disconnect
()
},
}
</
script
>
This diff is collapsed.
Click to expand it.
pages/index.vue
+
1
−
37
View file @
117beca3
...
...
@@ -37,49 +37,13 @@
<HomeNextEvents
/>
<section
id=
"map"
>
<div
class=
"container flex items-end mb-3"
>
<FaviconMap
class=
"w-12 h-12 mr-3 fill-current dark:text-gray-100"
/>
<a
href=
"https://carte.monnaie-libre.fr"
target=
"_blank"
class=
"
group
bg-clip-text bg-gradient-to-r
font-extrabold
from-purple-800
hover:underline
text-4xl text-transparent
to-blue-600
uppercase
"
rel=
"noopener noreferrer"
>
Carte
<fa
icon=
"external-link-alt"
class=
"w-3 ml-1.5 text-gray-500 opacity-0 group-hover:opacity-75"
/>
</a>
</div>
<iframe
src=
"https://carte.monnaie-libre.fr/?zoom=5"
class=
"w-screen"
style=
"height: 50vh; min-height: 600px"
title=
"Carte monnaie-libre"
/>
</section>
<HomeMap
/>
</div>
</
template
>
<
script
>
import
FaviconMap
from
'
~/static/img/favicon-map-g1.svg?inline
'
export
default
{
name
:
'
HomePage
'
,
components
:
{
FaviconMap
,
},
async
asyncData
({
$content
})
{
const
hero
=
await
$content
(
'
ui/home-hero
'
).
fetch
()
const
intro
=
await
$content
(
'
ui/home-intro
'
).
fetch
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment