Skip to content

Commit fe2da95

Browse files
committed
Add lazy load of images
1 parent 64b806c commit fe2da95

File tree

7 files changed

+49
-28
lines changed

7 files changed

+49
-28
lines changed

components/tools/gradient/editor.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
:class="{
6969
'is-active': $store.state.gradient.editorActive === 'direction'
7070
}"
71-
name="Gradient direction"
71+
aria-label="Gradient direction"
7272
@click="toggleEditor('direction')"
7373
@keydown.tab="tabAway($event, 'direction')"
7474
>
@@ -82,7 +82,7 @@
8282
:class="{
8383
'is-active': $store.state.gradient.editorActive === 'color1'
8484
}"
85-
name="Gradient start color"
85+
aria-label="Gradient start color"
8686
@click="toggleEditor('color1')"
8787
>
8888
<div
@@ -96,7 +96,7 @@
9696
:class="{
9797
'is-active': $store.state.gradient.editorActive === 'ease'
9898
}"
99-
name="Gradient timing function"
99+
aria-label="Gradient timing function"
100100
@click="toggleEditor('ease')"
101101
>
102102
<div
@@ -109,7 +109,7 @@
109109
:class="{
110110
'is-active': $store.state.gradient.editorActive === 'color2'
111111
}"
112-
name="Gradient stop color"
112+
aria-label="Gradient stop color"
113113
@click="toggleEditor('color2')"
114114
@keydown.tab="tabAway($event, 'color2')"
115115
>

components/tools/gradient/examples.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
2-
<div>
2+
<div v-lazy-container="{ selector: 'img' }">
33
<p>Gradients under text/ui are used to increase contrast but should often be as invisible as possible. The examples below have the same amount of blackness behind the text.</p>
4-
<div class="c-gradientExamples u-grid">
4+
<div
5+
class="c-gradientExamples u-grid"
6+
>
57
<div
68
class="c-gradientExamples-item"
79
>
@@ -11,7 +13,7 @@
1113
Linear
1214
</div>
1315
<img
14-
src="/images/gradient-plant.jpg"
16+
data-src="/images/gradient-plant.jpg"
1517
alt="plant"
1618
>
1719
</div>
@@ -24,7 +26,7 @@
2426
Easing
2527
</div>
2628
<img
27-
src="/images/gradient-plant.jpg"
29+
data-src="/images/gradient-plant.jpg"
2830
alt="plant"
2931
>
3032
</div>
@@ -51,13 +53,15 @@
5153
</div>
5254
</div>
5355
<p>I believe that there are many designs out there that could benefit from this approach, including the Spotify player shown below (click to see the big picture).</p>
54-
<div class="c-gradientExamples u-grid">
56+
<div
57+
class="c-gradientExamples u-grid"
58+
>
5559
<a
5660
href="/images/gradient-spotify-linear.jpg"
5761
class="c-gradientExamples-item"
5862
>
5963
<img
60-
src="/images/gradient-spotify-linear.jpg"
64+
data-src="/images/gradient-spotify-linear.jpg"
6165
alt="spotify with linear gradient"
6266
>
6367
</a>
@@ -66,7 +70,7 @@
6670
class="c-gradientExamples-item"
6771
>
6872
<img
69-
src="/images/gradient-spotify-easing.jpg"
73+
data-src="/images/gradient-spotify-easing.jpg"
7074
alt="spotify with easing gradient"
7175
>
7276
</a>

nuxt.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,18 @@ module.exports = {
7070
],
7171
},
7272
/*
73+
** Plugins
74+
*/
75+
plugins: [{ src: '~/plugins/vue-lazyload', ssr: false }],
76+
/*
7377
** Customize the progress bar color
7478
*/
7579
loading: false,
7680
/*
7781
** Build configuration
7882
*/
7983
build: {
84+
vendor: ['vue-lazyload'],
8085
plugins: [
8186
new BundleAnalyzerPlugin({
8287
analyzerMode: 'static',

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"push-dir": "^0.4.1",
5454
"throttleit": "^1.0.0",
5555
"vue-feather-icons": "^4.7.1",
56+
"vue-lazyload": "^1.2.3",
5657
"vue-slider-component": "^2.6.2",
5758
"webpack-bundle-analyzer": "^2.11.1"
5859
}

plugins/vue-lazyload.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Vue from 'vue'
2+
import VueLazyload from 'vue-lazyload'
3+
4+
Vue.use(VueLazyload)

static/manifest.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
2-
"name": "Larsenwork",
3-
"icons": [
4-
{
5-
"src": "/android-chrome-192x192.png",
6-
"sizes": "192x192",
7-
"type": "image/png"
8-
},
9-
{
10-
"src": "/android-chrome-512x512.png",
11-
"sizes": "512x512",
12-
"type": "image/png"
13-
}
14-
],
15-
"theme_color": "#ee2b7c",
16-
"background_color": "#ee2b7c",
17-
"display": "standalone"
18-
}
2+
"name": "Larsenwork",
3+
"short_name": "Larsenwork",
4+
"icons": [
5+
{
6+
"src": "/android-chrome-192x192.png",
7+
"sizes": "192x192",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "/android-chrome-512x512.png",
12+
"sizes": "512x512",
13+
"type": "image/png"
14+
}
15+
],
16+
"theme_color": "#ee2b7c",
17+
"background_color": "#ee2b7c",
18+
"display": "standalone"
19+
}

0 commit comments

Comments
 (0)