Skip to content

Commit d63763e

Browse files
authored
Merge pull request #10 from colbyfayock/redirect-asset-delivery
Redirect all /images links to Cloudinary
2 parents 0d05925 + 18abfb5 commit d63763e

28 files changed

+2135
-15
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules
2-
.env
2+
.env
3+
# Local Netlify folder
4+
.netlify

demo/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

demo/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel

demo/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
12+
13+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14+
15+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16+
17+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18+
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

demo/data/images.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"width": 2376,
4+
"height": 1574,
5+
"src": "/images/beach.jpeg",
6+
"title": "Beach"
7+
},
8+
{
9+
"width": 1364,
10+
"height": 1705,
11+
"src": "/images/city.jpeg",
12+
"title": "City"
13+
},
14+
{
15+
"width": 2344,
16+
"height": 1560,
17+
"src": "/images/earth.jpeg",
18+
"title": "Earth"
19+
},
20+
{
21+
"width": 2340,
22+
"height": 1560,
23+
"src": "/images/galaxy.jpeg",
24+
"title": "Galaxy"
25+
},
26+
{
27+
"width": 2148,
28+
"height": 1611,
29+
"src": "/images/iceberg.jpeg",
30+
"title": "Iceberg"
31+
},
32+
{
33+
"width": 1364,
34+
"height": 1705,
35+
"src": "/images/jungle.jpeg",
36+
"title": "Jungle"
37+
},
38+
{
39+
"width": 2340,
40+
"height": 1561,
41+
"src": "/images/mountain.jpeg",
42+
"title": "Mountain"
43+
},
44+
{
45+
"width": 2340,
46+
"height": 1560,
47+
"src": "/images/waterfall.jpeg",
48+
"title": "Waterfall"
49+
}
50+
]

demo/next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
reactStrictMode: true,
3+
}

demo/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "demo",
3+
"private": true,
4+
"scripts": {
5+
"dev": "next dev",
6+
"build": "next build",
7+
"start": "next start",
8+
"lint": "next lint"
9+
},
10+
"dependencies": {
11+
"next": "12.0.10",
12+
"react": "17.0.2",
13+
"react-dom": "17.0.2"
14+
},
15+
"devDependencies": {
16+
"eslint": "8.8.0",
17+
"eslint-config-next": "12.0.10"
18+
}
19+
}

demo/pages/_app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import '../styles/globals.css'
2+
3+
function MyApp({ Component, pageProps }) {
4+
return <Component {...pageProps} />
5+
}
6+
7+
export default MyApp

demo/pages/index.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { useState, useEffect } from 'react';
2+
import Head from 'next/head'
3+
import Image from 'next/image'
4+
import styles from '../styles/Home.module.css'
5+
6+
import dataImages from '../data/images';
7+
8+
export default function Home({ images }) {
9+
const [isLoaded, setIsLoaded] = useState();
10+
11+
useEffect(() => {
12+
setIsLoaded(true);
13+
}, [])
14+
15+
return (
16+
<div className={styles.container}>
17+
<Head>
18+
<title>Cloudinary Netlify Plugin</title>
19+
<meta name="description" content="Cloudinary Netlify Plugin" />
20+
</Head>
21+
22+
<main className={styles.main}>
23+
<h1 className={styles.title}>
24+
Cloudinary Netlify Plugin
25+
</h1>
26+
27+
<p className={styles.description}>
28+
<a href="https://github.com/colbyfayock/netlify-plugin-cloudinary">https://github.com/colbyfayock/netlify-plugin-cloudinary</a>
29+
</p>
30+
31+
<div className={styles.grid}>
32+
{images.map(image => {
33+
return (
34+
<li key={image.src}>
35+
<img src={image.src} width={image.width} height={image.height} alt={image.title} />
36+
</li>
37+
);
38+
})}
39+
</div>
40+
{isLoaded && (
41+
<div className={styles.grid}>
42+
{images.map(image => {
43+
return (
44+
<li key={image.src}>
45+
<img src={image.src} width={image.width} height={image.height} alt={image.title} />
46+
</li>
47+
);
48+
})}
49+
</div>
50+
)}
51+
</main>
52+
</div>
53+
)
54+
}
55+
56+
export async function getStaticProps() {
57+
return {
58+
props: {
59+
images: dataImages
60+
}
61+
}
62+
}

demo/public/images/beach.jpeg

553 KB
Loading

0 commit comments

Comments
 (0)