Skip to content

Commit

Permalink
fix(hero): image max width (#553)
Browse files Browse the repository at this point in the history
* fix(hero): image max width

* chore(lighthouse): use nuxt start

* fix: spelling

* fix(resume): href blank use rel noopener

* fix(hero): up scale image to 4686

* refactor(hero): use image rather than parallax

* refactor(hero): make gradient a prop

* perf: import icons as needed

* perf: extract css

* fix(home): add missing hero component import

* fix(lighthouse): unused javascript off

Co-authored-by: Damien Robinson <damien.robinson@xcommedia.com.au>
  • Loading branch information
shadow81627 and damienrobinson committed Aug 25, 2020
1 parent c08105f commit 1133a33
Show file tree
Hide file tree
Showing 19 changed files with 570 additions and 139 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module.exports = {
browser: true,
node: true,
},
parserOptions: {
parser: 'babel-eslint',
},
extends: [
'@nuxtjs',
'prettier',
Expand Down
7 changes: 0 additions & 7 deletions assets/README.md

This file was deleted.

Binary file modified assets/img/header-bg.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions components/README.md

This file was deleted.

9 changes: 1 addition & 8 deletions components/feature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<span class="h3 text-break text-no-wrap text-truncate">
<font-awesome-icon
v-if="blok.icon"
:icon="blok.icon | split"
:icon="blok.icon"
class="grey--text"
/>
{{ blok.name || blok.heading }}
Expand Down Expand Up @@ -52,13 +52,6 @@
<script>
import { mdiOpenInNew } from '@mdi/js';
export default {
filters: {
split(value, sep = ' ') {
if (!value) return '';
value = value.toString();
return value.split(sep);
},
},
props: { blok: { type: Object, required: true } },
data() {
return {
Expand Down
87 changes: 58 additions & 29 deletions components/hero.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,67 @@
<template>
<header>
<v-parallax
:lazy-src="require(`~/assets/img/header-bg.jpg?lqip`)"
:src="
require('~/assets/img/header-bg.jpg?resize&size=1785&placeholder').src
"
:src-set="
require(`~/assets/img/header-bg.jpg?resize&max=1785&min=320&steps=6`)
.srcSet
"
:style="{
backgroundColor: require('~/assets/img/header-bg.jpg?lqip-colors')[0],
}"
size="100vw"
>
<v-row align="center" justify="center">
<v-col class="text-center" cols="12">
<h1 v-if="heading" class="mb-4 text-light text-shadow">
{{ heading }}
</h1>
<h2 v-if="subheading" class="subheading text-light text-shadow">
{{ subheading }}
</h2>
</v-col>
</v-row>
</v-parallax>
</header>
<v-container class="pa-0" style="max-width: 1785px;">
<v-row no-gutters align="center" justify="center">
<v-col cols="12" align-self="center">
<v-card :color="color" flat dark tile>
<v-img
:lazy-src="lazySrc"
:src="src"
:src-set="srcSet"
:height="height"
width="1785"
sizes="(max-width: 1785px) 100vw, 1785px"
:gradient="gradient"
alt=""
>
<v-container
class="fill-height align-items-end justify-start"
fluid
>
<v-row align="center" justify="center">
<v-col class="text-center" cols="12">
<h1 v-if="heading" class="mb-4 text-shadow">
{{ heading }}
</h1>
<h2 v-if="subheading" class="subheading text-shadow">
{{ subheading }}
</h2>
</v-col>
</v-row>
</v-container>
</v-img>
</v-card>
</v-col>
</v-row>
</v-container>
</template>

<script>
export default {
props: {
heading: { type: String, required: false, default: null },
subheading: { type: String, required: false, default: null },
heading: { type: String, default: null },
subheading: { type: String, default: null },
gradient: {
type: String,
default: 'rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)',
},
height: { type: [Number, String], default: 500 },
color: {
type: String,
default: require(`~/assets/img/header-bg.jpg?lqip-colors`)[0],
},
},
computed: {
lazySrc() {
return require(`~/assets/img/header-bg.jpg?lqip`);
},
src() {
return require(`~/assets/img/header-bg.jpg?resize&size=1785&placeholder`)
.src;
},
srcSet() {
return require(`~/assets/img/header-bg.jpg?resize&sizes[]=320&sizes[]=600&sizes[]=900&sizes[]=1785&sizes[]=4686&format=webp`)
.srcSet;
},
},
};
</script>
8 changes: 8 additions & 0 deletions images.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const sharp = require('sharp');

const file = 'assets/img/header-bg.jpg';
sharp(file)
.resize(4686)
.toFile(`assets/img/header-bg-1.jpg`, (err, info) => {
console.log(err, info);
});
7 changes: 0 additions & 7 deletions layouts/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
:src="require('~/assets/img/logo.svg?inline')"
class="navbar-brand"
height="24"
contain
width="60"
alt="Daim"
/>
</v-toolbar-title>
Expand Down
3 changes: 2 additions & 1 deletion lighthouserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"assertions": {
"color-contrast": "off",
"unused-css-rules": "off",
"uses-http2": "off"
"uses-http2": "off",
"unused-javascript": "off"
}
},
"upload": {
Expand Down
25 changes: 10 additions & 15 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
/*
** Plugins to load before mounting the App
*/
plugins: ['~/plugins/components.js'],
plugins: [],

/*
** Nuxt.js dev-modules
Expand Down Expand Up @@ -124,19 +124,6 @@ export default {
*/
axios: {},

fontawesome: {
imports: [
{
set: '@fortawesome/free-solid-svg-icons',
icons: ['fas'],
},
{
set: '@fortawesome/free-brands-svg-icons',
icons: ['fab'],
},
],
},

i18n: {
baseUrl: 'https://daim.dev',
seo: false,
Expand All @@ -160,6 +147,14 @@ export default {
mozjpeg: {
quality: 50,
},
responsive: {
adapter: require('responsive-loader/sharp'),
sharp: {
format: {
webp: true,
},
},
},
},

purgeCSS: {
Expand Down Expand Up @@ -192,7 +187,7 @@ export default {
chunk: ({ isDev }) =>
isDev ? '[name].js' : 'chunks/[id].[contenthash].js',
},
// extractCSS: true,
extractCSS: true,
/*
** You can extend webpack config here
*/
Expand Down

1 comment on commit 1133a33

@vercel
Copy link

@vercel vercel bot commented on 1133a33 Aug 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.