docs: update Evan Tay personal site showcase (#6855)

* docs: update evantay showcase image

* docs: update evnatay showcase title

* fix test

* retake photo

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Evan 2022-03-06 13:59:42 +08:00 committed by GitHub
parent 4db0c620de
commit edb4d00096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View file

@ -12,6 +12,7 @@ import fs from 'fs-extra';
import path from 'path'; import path from 'path';
import imageSize from 'image-size'; import imageSize from 'image-size';
import {fileURLToPath} from 'url'; import {fileURLToPath} from 'url';
import logger from '@docusaurus/logger';
const allImages = ( const allImages = (
await fs.readdir(new URL('../../website/src/data/showcase', import.meta.url)) await fs.readdir(new URL('../../website/src/data/showcase', import.meta.url))
@ -27,10 +28,11 @@ await Promise.all(
); );
const {width, height} = imageSize(imgPath); const {width, height} = imageSize(imgPath);
if (width === 640 && height === 320) { if (width === 640 && height === 320) {
// Do not emit if no resized. Important because we // Do not emit if not resized. Important because we can't guarantee
// can't guarantee idempotency during resize -> optimization // idempotency during resize -> optimization
return; return;
} }
logger.info`Resized path=${imgPath}: Before number=${width}×number=${height}`;
const data = await sharp(imgPath) const data = await sharp(imgPath)
.resize(640, 320, {fit: 'cover', position: 'top'}) .resize(640, 320, {fit: 'cover', position: 'top'})
.png() .png()

View file

@ -27,11 +27,11 @@ expect.extend({
toHaveGoodDimensions({width, height}: {width: number; height: number}) { toHaveGoodDimensions({width, height}: {width: number; height: number}) {
// Put this one first because aspect ratio is harder to fix than resizing // Put this one first because aspect ratio is harder to fix than resizing
// (need to take another screenshot) // (need to take another screenshot)
if (width / height < 0.5) { if (width / height > 2) {
return { return {
pass: false, pass: false,
message: () => message: () =>
`The preview image's width is ${width} and height is ${height}. To make sure it takes up the entire container in our showcase card, it needs to have a minimum aspect ratio of 2:1. Please make your image taller.`, `The preview image's width is ${width} and height is ${height}. To make sure it takes up the entire container in our showcase card, it needs to have an aspect ratio of no wider than 2:1. Please make your image taller.`,
}; };
} else if (width < 640) { } else if (width < 640) {
return { return {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

View file

@ -559,7 +559,7 @@ const Users: User[] = [
tags: ['opensource', 'personal', 'i18n'], tags: ['opensource', 'personal', 'i18n'],
}, },
{ {
title: "Evan Tay's Personal Website", title: "KayaFolio",
description: description:
"A Software Engineer's blog, documentation and project portfolio.", "A Software Engineer's blog, documentation and project portfolio.",
preview: require('./showcase/evantay.png'), preview: require('./showcase/evantay.png'),