Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
feat(website): support lazy loading the images from the blog section
Browse files Browse the repository at this point in the history
  • Loading branch information
juliomrqz committed Mar 20, 2019
1 parent 3fad766 commit 136c01a
Show file tree
Hide file tree
Showing 17 changed files with 2,187 additions and 77 deletions.
3 changes: 2 additions & 1 deletion packages/@statusfy/core/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ module.exports = {
workbox: true,
manifest: true
}
]
],
"@bazzite/nuxt-optimized-images"
],
/*
** Build configuration
Expand Down
4 changes: 4 additions & 0 deletions packages/website/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ pre[class*=language-] {
@apply mt-2;
}
}

table {
display: table;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions packages/website/components/Image.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<template>
<span
v-lazy-container="{ selector: 'img' }"
class="image-placeholder"
:class="{ fluid: fluid, 'rounded-full': rounded }"
>
<img
:src="imagePlaceholder"
:data-src="imageSource"
:data-loading="imagePlaceholder"
:width="`${width}`"
:height="`${height}`"
:class="finalClass"
:alt="alt"
>
</span>
</template>

<script>
export default {
props: {
source: {
type: String,
required: true
},
alt: {
type: String,
required: true
},
width: {
type: Number,
required: true
},
height: {
type: Number,
required: true
},
classes: {
type: String,
default: ''
},
fluid: {
type: Boolean,
default: false
},
rounded: {
type: Boolean,
default: false
}
},
computed: {
imageSource() {
return require(`~/assets/img/${this.source}`)
},
imagePlaceholder() {
return require(`~/assets/img/${this.source}?lqip`)
},
finalClass() {
let theClass = this.classes
if (this.rounded) {
theClass += ' rounded-full'
}
return theClass
}
}
}
</script>

<style lang="scss" scoped>
.image-placeholder {
overflow: hidden;
line-height: 0;
display: inline-block;
&.fluid {
img {
width: 100%;
max-width: 100%;
height: auto;
}
}
}
img {
transition: all ease 0.3s;
opacity: 0.95;
filter: blur(15px);
&[lazy='loading'] {
opacity: 1;
filter: blur(15px);
}
&[lazy='loaded'] {
opacity: 1;
filter: none;
}
}
</style>
26 changes: 18 additions & 8 deletions packages/website/components/blog/AuthorCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
v-if="mode === 'simple'"
class="flex flex-wrap items-center text-grey-darker"
>
<img
:src="require(`~/assets/img/avatars/${post.author.username}.jpg`)"
class="rounded-full w-10 h-10"
>
<ImageResponsive
:source="`avatars/${post.author.username}.jpg`"
:alt="post.author.name"
:rounded="true"
classes="w-10 h-10"
:width="40"
:height="40"
/>

<span class="ml-4 font-semibold relative z-10">
<a
:href="`https://www.bazzite.com/blog/author/${post.author.username}`"
Expand All @@ -24,10 +29,15 @@
v-else-if="mode === 'advanced'"
class="flex flex-wrap flex-col items-center justify-center text-grey-darker sm:justify-start sm:flex-row"
>
<img
:src="require(`~/assets/img/avatars/${post.author.username}.jpg`)"
class="rounded-full w-12 h-12"
>
<ImageResponsive
:source="`avatars/${post.author.username}.jpg`"
:alt="post.author.name"
:rounded="true"
classes="w-12 h-12"
:width="40"
:height="40"
/>

<div class="flex flex-col mx-4 mt-2">
<span class="font-semibold mb-1 text-center sm:text-left">
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ created: "2018-11-14T14:58:34.140255Z"
canonical: https://www.bazzite.com/blog/introducing-statusfy-marvelous-open-source-status-page-system
---

[Statusfy][statusfy-home] is a Status Page System, easy to use and completely Open Source. You can easily create a fast System either **Static Generated** or **Server Rendered** and easily deploy it to a variety of hosting services. The goal behind is to lower costs and complexity providing a simpler and versatile Open Source alternative.

<NuxtLink :to="`${localePath('index')}`">Statusfy</NuxtLink> is a Status Page System, easy to use and completely Open Source. You can easily create a fast System either **Static Generated** or **Server Rendered** and easily deploy it to a variety of hosting services. The goal behind is to lower costs and complexity providing a simpler and versatile Open Source alternative.

But, you may be thinking: Why do I need a Status Page System?. These systems are pretty simple and have one main task: communicate the status of an application or service. Nowadays, every single SaaS product should have a Status Page System, they allow us to increase customer confidence and reduce customer frustration about any service disruptions by giving retrospectives (also called Root Cause Analysis). With these systems, you can notify about service disruptions, planned maintenance or possible outages through multiple channels: email, SMS, Push, Webhooks, etc.

Expand Down Expand Up @@ -41,7 +42,6 @@ For these two ways of delivering your Statusfy Application, you can use great Ho
| [Surge](https://docs.statusfy.co/guide/deploy.html#surge) | [Yes](https://github.com/bazzite/statusfy-examples/blob/master/surge/static-generated) | No |
| [Heroku](https://docs.statusfy.co/guide/deploy.html#heroku) | [Yes](https://github.com/bazzite/statusfy-examples/blob/master/heroku/static-generated) | [Yes](https://github.com/bazzite/statusfy-examples/blob/master/heroku/server-rendered) |
| [Now](https://docs.statusfy.co/guide/deploy.html#now) | [Yes](https://github.com/bazzite/statusfy-examples/blob/master/now/static-generated) | [Yes](https://github.com/bazzite/statusfy-examples/blob/master/heroku/server-rendered) |
{.table .table-striped .table-bordered}

## Creating a Status Page System

Expand Down Expand Up @@ -91,7 +91,7 @@ npm run start # OR yarn start

## What's next

In the next couple of months, we're going to continue to improve the [documentation][statusy-docs], [create tutorials][statusy-blog], [fix bugs][statusy-github], create a Project Editor, and add [extra features][statusy-docs-todo].
In the next couple of months, we're going to continue to improve the [documentation][statusy-docs], <NuxtLink :to="`${localePath('blog')}`">create tutorials</NuxtLink>, [fix bugs][statusy-github], create a Project Editor, and add [extra features][statusy-docs-todo].


## Contribute to Statusfy
Expand Down
13 changes: 8 additions & 5 deletions packages/website/content/blog/en/statusfy-release-0-2-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ We just released a [new version][github-release] of Statusfy with new big featur

## Scheduled Maintenance

<p class="text-center">
<img src="https://media.bazzite.com/blog/2018/12/statusfy-release-v-0-2-0-scheduled-maintenance-en.jpg" width="879" height="278" class="img-fluid" alt="Statusfy - Scheduled Maintenance" />
</p>
<ImageResponsive
source="blog/statusfy-release-v-0-2-0/scheduled-maintenance-en.jpg"
alt="Statusfy - Scheduled Maintenance"
:fluid="true"
:width="879"
:height="278"
/>

[Scheduled Maintenances][docs-scheduled-maintenance] definition is a way to let your users know ahead of time when your system(s) cannot handle requests due to a temporary maintenance update.

Expand All @@ -42,13 +46,12 @@ Now you can notify to the search engine bots the available pages in your Status

Statusfy is a completely open source project, created and maintained by [Bazzite][bazzite-home]. It's still a work in progress, so any contribution is very welcome. We're passionate about building a versatile and a lower cost solution.

You can also support us by giving a [GitHub star ★][statusy-github] , spreading the word or [donating][statusfy-sponsoring] 🤓.
You can also support us by giving a [GitHub star ★][statusy-github], spreading the word or <NuxtLink :to="`${localePath('support')}#sponsoring`">donating</NuxtLink> 🤓.



[bazzite-home]: https://www.bazzite.com
[statusy-github]: https://github.com/bazzite/statusfy
[statusfy-sponsoring]: https://statusfy.co/support#sponsoring
[docs-scheduled-maintenance]: https://docs.statusfy.co/guide/incidents.html#scheduled-maintenance
[docs-notifications]: https://docs.statusfy.co/guide/notifications.html
[docs-docs-notifications]: https://docs.statusfy.co/config/#notifications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ created: "2018-11-14T14:58:34.140255Z"
canonical: https://www.bazzite.com/es/blog/introducing-statusfy-marvelous-open-source-status-page-system
---

[Statusfy][statusfy-home] es un Sistema de Página de Estado, fácil de usar y completamente de código abierto. Puedes crear fácilmente un Sistema rápido, ya sea **Estático** o **Renderizado por Servidor**, e implementarlo fácilmente en una **variedad de servicios de alojamiento**. El objetivo detrás es reducir los costos y la complejidad, proporcionando una alternativa de código abierto más simple y versátil.

<NuxtLink :to="`${localePath('index')}`">Statusfy</NuxtLink> es un Sistema de Página de Estado, fácil de usar y completamente de código abierto. Puedes crear fácilmente un Sistema rápido, ya sea **Estático** o **Renderizado por Servidor**, e implementarlo fácilmente en una **variedad de servicios de alojamiento**. El objetivo detrás es reducir los costos y la complejidad, proporcionando una alternativa de código abierto más simple y versátil.

Sin embargo, puedes estar preguntándote: ¿Por qué necesito un sistema de página de estado?. Estos sistemas son bastante simples y tienen una tarea principal: comunicar el estado de una aplicación o servicio. Hoy en día, cada producto SaaS debe tener un sistema de página de estado, ellos nos permiten aumentar la confianza del cliente y reducir su frustración por cualquier interrupción del servicio mediante retrospectivas (también llamadas Análisis de Causa Raíz). Con estos sistemas, puedes notificar las interrupciones del servicio, mantenimientos planificados o posibles interrupciones a través de múltiples canales: correo electrónico, SMS, Push, Webhooks, etc.

Expand Down Expand Up @@ -39,7 +40,6 @@ Para estas dos formas de entrega de tu aplicación Statusfy, puedes usar excelen
| [Surge](https://docs.statusfy.co/es/guide/deploy.html#surge) | [](https://github.com/bazzite/statusfy-examples/blob/master/surge/static-generated) | No |
| [Heroku](https://docs.statusfy.co/es/guide/deploy.html#heroku) | [](https://github.com/bazzite/statusfy-examples/blob/master/heroku/static-generated) | [](https://github.com/bazzite/statusfy-examples/blob/master/heroku/server-rendered) |
| [Now](https://docs.statusfy.co/es/guide/deploy.html#now) | [](https://github.com/bazzite/statusfy-examples/blob/master/now/static-generated) | [](https://github.com/bazzite/statusfy-examples/blob/master/heroku/server-rendered) |
{.table .table-striped .table-bordered}

## Creación de un Sistema de Página de Estado

Expand Down Expand Up @@ -88,7 +88,7 @@ npm run start # O yarn start

## Que sigue

En los próximos meses, continuaremos mejorando la [documentación][statusy-docs], [crearemos nuevos tutoriales][statusy-blog], [corregiremos errores][statusy-github], crearemos un Editor de Proyecto y agregaremos [funcionalidades adicionales][statusy-docs-todo].
En los próximos meses, continuaremos mejorando la [documentación][statusy-docs], <NuxtLink :to="`${localePath('blog')}`">crearemos nuevos tutoriales</NuxtLink>, [corregiremos errores][statusy-github], crearemos un Editor de Proyecto y agregaremos [funcionalidades adicionales][statusy-docs-todo].

## Contribuye a Statusfy

Expand All @@ -98,7 +98,6 @@ También puedes ayudarnos dando una [estrella en GitHub ★][statusy-github] y c

<!-- enlaces -->

[statusfy-home]: https://statusfy.co/es/
[statusy-docs]: https://docs.statusfy.co/es/
[statusy-docs-todo]: https://docs.statusfy.co/es/guide/#por-hacer
[statusy-blog]: https://statusfy.co/es/blog
Expand Down
13 changes: 8 additions & 5 deletions packages/website/content/blog/es/statusfy-release-0-2-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ Acabamos de lanzar una [nueva versión][github-release] de Statusfy con nuevas f

## Mantenimiento Programado

<p class="text-center">
<img src="https://media.bazzite.com/blog/2018/12/statusfy-release-v-0-2-0-scheduled-maintenance-es.jpg" width="879" height="278" class="img-fluid" alt="Statusfy - Mantenimiento Programado" />
</p>
<ImageResponsive
source="blog/statusfy-release-v-0-2-0/scheduled-maintenance-es.jpg"
alt="Statusfy - Mantenimiento Programado"
:fluid="true"
:width="879"
:height="278"
/>

La definición de [Mantenimiento Programados][docs-scheduled-maintenance] es una forma de informar con anticipación a tus usuarios cuando su sistema no puede manejar solicitudes debido a una actualización de mantenimiento temporal.

Expand All @@ -40,13 +44,12 @@ Ahora puedes indicarle a los bots de los motores de búsqueda las páginas dispo

Statusfy es un proyecto completamente abierto, creado y actualizado por [Bazzite][bazzite-home]. Todavía es un trabajo en progreso, por lo que cualquier contribución es bienvenida. Nos apasiona construir una solución versátil y de menor costo.

También puedes ayudarnos dando una [estrella en GitHub ★][statusy-github], corriendo la voz o [dando una donación][statusfy-sponsoring] 🤓.
También puedes ayudarnos dando una [estrella en GitHub ★][statusy-github], corriendo la voz o <NuxtLink :to="`${localePath('support')}#sponsoring`">dando una donación</NuxtLink> 🤓.



[bazzite-home]: https://www.bazzite.com/es
[statusy-github]: https://github.com/bazzite/statusfy
[statusfy-sponsoring]: https://statusfy.co/es/support#sponsoring
[docs-scheduled-maintenance]: https://docs.statusfy.co/es/guide/incidents.html#mantenimiento-programado
[docs-notifications]: https://docs.statusfy.co/es/guide/notifications.html
[docs-docs-notifications]: https://docs.statusfy.co/es/config/#notifications
Expand Down
1 change: 1 addition & 0 deletions packages/website/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module.exports = {
*/
plugins: [
'~/plugins/statusfy-blog.js',
'~/plugins/statusfy-global-components.js',
'~/plugins/axios.js',
'~/plugins/vue-disqus',
'~/plugins/vue-lazyload.js',
Expand Down
11 changes: 10 additions & 1 deletion packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,30 @@
"webfontloader": "^1.6.28"
},
"devDependencies": {
"@bazzite/nuxt-optimized-images": "^0.1.0",
"@wordpress/wordcount": "^2.1.0",
"babel-eslint": "^10.0.1",
"cross-spawn": "^6.0.5",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-prettier": "^3.0.0",
"front-matter": "^3.0.1",
"imagemin-gifsicle": "^6.0.1",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-pngquant": "^7.0.0",
"imagemin-svgo": "^7.0.0",
"loader-utils": "^1.2.3",
"lodash.pick": "^4.4.0",
"lqip-loader": "^2.2.0",
"markdown-it": "^8.4.2",
"markdown-it-attrs": "^2.3.2",
"markdown-it-github-headings": "^1.1.1",
"markdown-it-inline-comments": "^1.0.1",
"markdown-it-link-attributes": "^2.1.0",
"markdown-it-prism": "^2.0.1",
"prettier": "1.14.3"
"prettier": "1.14.3",
"responsive-loader": "^1.2.0",
"sharp": "^0.22.0",
"webp-loader": "^0.4.0"
},
"engines": {
"node": ">=8.10"
Expand Down
6 changes: 6 additions & 0 deletions packages/website/pages/blog/_slug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,10 @@ export default {
top: -30px;
}
}
.markdown-body {
>>> .anchor {
@apply hidden;
}
}
</style>
4 changes: 4 additions & 0 deletions packages/website/plugins/statusfy-global-components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue'
import ImageResponsive from "~/components/Image.vue";

Vue.component('ImageResponsive', ImageResponsive)
1 change: 1 addition & 0 deletions packages/website/plugins/vue-lazyload.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Vue from 'vue'
import VueLazyload from 'vue-lazyload'

Vue.use(VueLazyload, {
lazyComponent: true,
silent: !process.env.isDev,
observer: true,
loading: require('~/assets/img/loading.svg')
Expand Down
2 changes: 0 additions & 2 deletions packages/website/webpack/markdown-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module.exports = function (source) {

const {
html,
body,
attributes
} = options.markdown(entry, source)

Expand All @@ -36,7 +35,6 @@ module.exports = function (source) {
}

const output = `
body: ${stringify(body)},
html: ${stringify(html)},
attributes: ${stringify(attributes)},
vue: {
Expand Down
Loading

0 comments on commit 136c01a

Please sign in to comment.