diff --git a/build-cards.js b/build-cards.js index b0f99d20c..fab10abc5 100644 --- a/build-cards.js +++ b/build-cards.js @@ -1,6 +1,6 @@ const fs = require('fs') const glob = require('glob') -const { chromium } = require('playwright') +const { chromium, devices } = require('playwright') const { getAllPostsIds } = require('./src/lib/posts') const cardsDir = './public/cards/' @@ -20,18 +20,13 @@ glob('./cards/**.png', async (err, files) => { }) const baseUrl = process.env.CARDS_BASE_URL || 'http://localhost:3000' +const device = devices['Desktop Safari'] async function getScreenshot(postId) { - const width = 1200 - const height = 630 const browser = await chromium.launch() - const context = await browser.newContext({ deviceScaleFactor: 2 }) + const context = await browser.newContext({ ...device, deviceScaleFactor: 2 }) const page = await context.newPage() - await page.setViewportSize({ - width: width, - height: height, - }) await page.goto(`${baseUrl}/cards/${postId}`) await page.waitForTimeout(2000) // wait for page to load fully (2 seconds). This is a hacky way to wait for GitHub Avatars to fully load. diff --git a/public/cards/czi-eoss-grant-conclusion.png b/public/cards/czi-eoss-grant-conclusion.png index 054c0b470..8e051f83c 100644 Binary files a/public/cards/czi-eoss-grant-conclusion.png and b/public/cards/czi-eoss-grant-conclusion.png differ diff --git a/src/pages/cards/[id].js b/src/pages/cards/[id].js index 3504d39e2..0f3f4597d 100644 --- a/src/pages/cards/[id].js +++ b/src/pages/cards/[id].js @@ -19,16 +19,21 @@ import matter from 'gray-matter' import path from 'path' const Card = ({ frontmatter, id }) => { - const boxBackground = 'gray.300' + const boxBackground = 'teal.100' const date = new Date(frontmatter.date) return ( - - + + - + xarray.dev / blog @@ -53,7 +58,7 @@ const Card = ({ frontmatter, id }) => { - {formatDate(date)} + {formatDate(date)}