Skip to content

Commit 0d7bb10

Browse files
authored
Merge pull request #1 from styxlab/review-leerob
minor fixes
2 parents 8d26d02 + fb1c8a5 commit 0d7bb10

File tree

8 files changed

+49
-28
lines changed

8 files changed

+49
-28
lines changed

examples/cms-ghost/components/cover-image.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
import cn from 'classnames'
22
import Link from 'next/link'
3-
import Imgix from 'react-imgix'
3+
import Image from 'next/image'
44

5-
export default function CoverImage({ title, url, slug }) {
5+
export default function CoverImage({ title, url, slug, width, height }) {
66
const image = (
7-
<Imgix
7+
<Image
88
src={url}
99
alt={`Cover Image for ${title}`}
10-
className={cn('lazyload shadow-small w-full', {
11-
'hover:shadow-medium transition-shadow duration-200': slug,
10+
className={cn('shadow-sm', {
11+
'hover:shadow-md transition-shadow duration-200': slug,
1212
})}
13-
sizes="100vw"
14-
attributeConfig={{
15-
src: 'data-src',
16-
srcSet: 'data-srcset',
17-
sizes: 'data-sizes',
18-
}}
19-
htmlAttributes={{
20-
src: `${url}?auto=format,compress&q=1&blur=500&w=auto`,
21-
}}
13+
layout="responsive"
14+
width={width}
15+
height={height}
2216
/>
2317
)
2418
return (

examples/cms-ghost/components/hero-post.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ export default function HeroPost({
1414
return (
1515
<section>
1616
<div className="mb-8 md:mb-16">
17-
<CoverImage title={title} url={coverImage} slug={slug} />
17+
<CoverImage
18+
title={title}
19+
url={coverImage}
20+
slug={slug}
21+
width={2000}
22+
height={1216}
23+
/>
1824
</div>
1925
<div className="md:grid md:grid-cols-2 md:col-gap-16 lg:col-gap-8 mb-20 md:mb-28">
2026
<div>

examples/cms-ghost/components/post-header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function PostHeader({ title, coverImage, date, author }) {
1111
<Avatar name={author.title} picture={author.profile_image} />
1212
</div>
1313
<div className="mb-8 md:mb-16 sm:mx-0">
14-
<CoverImage title={title} url={coverImage} />
14+
<CoverImage title={title} url={coverImage} width={2000} height={1216} />
1515
</div>
1616
<div className="max-w-2xl mx-auto">
1717
<div className="block md:hidden mb-6">

examples/cms-ghost/components/post-preview.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ export default function PostPreview({
1414
return (
1515
<div>
1616
<div className="mb-5">
17-
<CoverImage slug={slug} title={title} url={coverImage} />
17+
<CoverImage
18+
slug={slug}
19+
title={title}
20+
url={coverImage}
21+
width={2000}
22+
height={1216}
23+
/>
1824
</div>
1925
<h3 className="text-3xl mb-3 leading-snug">
20-
<Link as={`/posts/${slug}`} href="/posts/[slug]">
26+
<Link href={`/posts/${slug}`}>
2127
<a className="hover:underline">{title}</a>
2228
</Link>
2329
</h3>

examples/cms-ghost/lib/api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import GhostContentAPI from '@tryghost/content-api'
2+
import { GHOST_API_URL_DEFAULT, GHOST_API_KEY_DEFAULT } from './defaults.js'
23

3-
const GHOST_API_URL = process.env.GHOST_API_URL || 'https://cms.gotsby.org'
4-
const GHOST_API_KEY = process.env.GHOST_API_KEY || '387f956eaa95345f7bb484d0b8'
4+
const GHOST_API_URL = process.env.GHOST_API_URL || GHOST_API_URL_DEFAULT
5+
const GHOST_API_KEY = process.env.GHOST_API_KEY || GHOST_API_KEY_DEFAULT
56

67
const api = new GhostContentAPI({
78
url: GHOST_API_URL,

examples/cms-ghost/lib/defaults.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const GHOST_API_URL_DEFAULT = Buffer.from(
2+
'aHR0cHM6Ly9jbXMuZ290c2J5Lm9yZw==',
3+
'base64'
4+
).toString('utf-8')
5+
6+
export const GHOST_API_KEY_DEFAULT = Buffer.from(
7+
'Mzg3Zjk1NmVhYTk1MzQ1ZjdiYjQ4NGQwYjg=',
8+
'base64'
9+
).toString('utf-8')

examples/cms-ghost/next.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
images: {
3+
domains: ['static.gotsby.org'],
4+
},
5+
}

examples/cms-ghost/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
"start": "next start"
88
},
99
"dependencies": {
10-
"@tryghost/content-api": "^1.4.10",
10+
"@tryghost/content-api": "^1.4.13",
1111
"classnames": "2.2.6",
12-
"date-fns": "2.14.0",
13-
"lazysizes": "^5.2.1-rc2",
12+
"date-fns": "2.16.1",
13+
"lazysizes": "^5.3.0",
1414
"next": "latest",
15-
"react": "^16.13.1",
16-
"react-imgix": "^9.0.2",
17-
"react-dom": "^16.13.1"
15+
"postcss": "^8.2.4",
16+
"react": "^17.0.1",
17+
"react-dom": "^17.0.1"
1818
},
1919
"devDependencies": {
20-
"postcss-flexbugs-fixes": "4.2.1",
20+
"postcss-flexbugs-fixes": "^5.0.2",
2121
"postcss-preset-env": "^6.7.0",
22-
"tailwindcss": "^1.4.6"
22+
"tailwindcss": "^2.0.2"
2323
},
2424
"license": "MIT"
2525
}

0 commit comments

Comments
 (0)