Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
Philippe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
Philippe
Commits
aabcab33
Commit
aabcab33
authored
Jun 19, 2021
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Minor errors post rebase
parent
2789b669
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
33 deletions
+41
-33
.gitignore
.gitignore
+2
-0
BackHome.js
components/BackHome.js
+2
-2
index.js
pages/index.js
+15
-15
[id].js
pages/photos/[id].js
+22
-16
No files found.
.gitignore
View file @
aabcab33
...
@@ -4,3 +4,5 @@ node_modules/
...
@@ -4,3 +4,5 @@ node_modules/
# TODO: Video Content
# TODO: Video Content
*.MOV
*.MOV
*.mp4
*.mp4
.vercel
components/BackHome.js
View file @
aabcab33
import
Image
from
"next/image
"
;
import
Link
from
"next/link
"
;
import
{
Text
,
Flex
}
from
"@chakra-ui/react"
;
import
{
Button
,
Text
,
Flex
}
from
"@chakra-ui/react"
;
function
BackHome
()
{
function
BackHome
()
{
return
(
return
(
...
...
pages/index.js
View file @
aabcab33
// pages/index.js
// pages/index.js
import
Head
from
"next/head"
;
import
Head
from
"next/head"
;
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
useState
}
from
"react"
;
import
{
Box
,
Container
,
Text
,
Wrap
,
WrapItem
}
from
"@chakra-ui/react"
;
import
{
Box
,
Link
,
Container
,
Text
,
Wrap
,
WrapItem
}
from
"@chakra-ui/react"
;
import
Image
from
"next/image"
;
import
Image
from
"next/image"
;
import
{
getAllPhotos
}
from
"../lib/utils"
;
import
{
getAllPhotos
}
from
"../lib/utils"
;
import
Link
from
"next/link"
;
import
{
getPlaiceholder
}
from
"plaiceholder"
;
import
{
getPlaiceholder
}
from
"plaiceholder"
;
export
async
function
getStaticProps
()
{
export
async
function
getStaticProps
()
{
let
data
=
await
getAllPhotos
()
.
slice
(
0
,
10
)
;
let
data
=
await
getAllPhotos
();
let
placeholders
=
{};
let
placeholders
=
{};
data
.
forEach
((
photo
)
=>
{
data
.
forEach
((
photo
)
=>
{
try
{
try
{
...
@@ -65,7 +64,7 @@ export default function Home({ data, placeholders }) {
...
@@ -65,7 +64,7 @@ export default function Home({ data, placeholders }) {
m
=
{
3
}
m
=
{
3
}
bg
=
"white"
bg
=
"white"
lineHeight
=
"0"
lineHeight
=
"0"
_hover
=
{{
boxShadow
:
"dark-lg"
,
rounded
:
"20px"
}}
_hover
=
{{
boxShadow
:
"dark-lg"
,
rounded
:
"20px"
}}
>
>
<
Link
href
=
{
`/photos/
${
photo
.
id
}
`
}
>
<
Link
href
=
{
`/photos/
${
photo
.
id
}
`
}
>
{
/*<img
{
/*<img
...
@@ -75,18 +74,19 @@ export default function Home({ data, placeholders }) {
...
@@ -75,18 +74,19 @@ export default function Home({ data, placeholders }) {
width="80px"
width="80px"
color="gray.700"
color="gray.700"
/>*/
}
/>*/
}
<
Image
<
Image
key
=
{
photo
.
path
}
key
=
{
photo
.
path
}
src
=
{
photo
.
path
}
src
=
{
photo
.
path
}
width
=
{
240
}
width
=
{
240
}
height
=
{
240
}
height
=
{
240
}
objectFit
=
"cover"
objectFit
=
"cover"
placeholder
=
"blur"
quality
=
{
20
}
priority
placeholder
=
"blur"
blurDataURL
=
{
`
${
placeholders
[
photo
.
id
]}
`
}
priority
/
>
blurDataURL
=
{
`
${
placeholders
[
photo
.
id
]}
`
}
/
>
{
/*<Image
{
/*<Image
key={"img-" + photo.path}
key={"img-" + photo.path}
src={photo.path}
src={photo.path}
height="240px"
height="240px"
...
...
pages/photos/[id].js
View file @
aabcab33
...
@@ -6,11 +6,11 @@ import {
...
@@ -6,11 +6,11 @@ import {
Text
,
Text
,
Flex
,
Flex
,
Spacer
,
Spacer
,
Link
,
Button
,
Button
,
}
from
"@chakra-ui/react"
;
}
from
"@chakra-ui/react"
;
import
Image
from
"next/image"
;
import
Image
from
"next/image"
;
import
Head
from
"next/head"
;
import
Head
from
"next/head"
;
import
Link
from
"next/link"
;
import
BackHome
from
"../../components/BackHome"
;
import
BackHome
from
"../../components/BackHome"
;
// import { getPlaiceholder } from "plaiceholder";
// import { getPlaiceholder } from "plaiceholder";
...
@@ -30,12 +30,13 @@ export async function getStaticPaths() {
...
@@ -30,12 +30,13 @@ export async function getStaticPaths() {
export
async
function
getStaticProps
({
params
})
{
export
async
function
getStaticProps
({
params
})
{
const
photo
=
await
getPhotoById
(
params
.
id
);
const
photo
=
await
getPhotoById
(
params
.
id
);
let
placeholder
=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mPkqgcAAJkAi3T5YcEAAAAASUVORK5CYII="
;
let
placeholder
=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mPkqgcAAJkAi3T5YcEAAAAASUVORK5CYII="
;
// getPlaiceholder(photo.path).then(({ base64 }) => {
// getPlaiceholder(photo.path).then(({ base64 }) => {
// placeholder = base64;
// placeholder = base64;
// console.log("image", photo.id, ":", photo.path);
// console.log("image", photo.id, ":", photo.path);
// console.log("blurDataURL:", placeholder);
// console.log("blurDataURL:", placeholder);
// });
// });
// Fix dimensions if really big picture
// Fix dimensions if really big picture
...
@@ -50,17 +51,22 @@ export async function getStaticProps({ params }) {
...
@@ -50,17 +51,22 @@ export async function getStaticProps({ params }) {
photo
.
dimensions
.
height
/=
2
;
photo
.
dimensions
.
height
/=
2
;
console
.
log
(
"Resized: "
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
console
.
log
(
"Resized: "
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
// Fix dimensions if really big picture
// Fix dimensions if really big picture
console
.
log
(
"Pic dims: "
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
console
.
log
(
"Pic dims: "
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
if
(
photo
.
dimensions
.
widths
>
1000
||
photo
.
dimensions
.
heigth
>
1000
)
{
if
(
photo
.
dimensions
.
widths
>
1000
||
photo
.
dimensions
.
heigth
>
1000
)
{
photo
.
dimensions
.
width
/=
2
;
photo
.
dimensions
.
width
/=
2
;
photo
.
dimensions
.
height
=
2
;
photo
.
dimensions
.
height
=
2
;
console
.
log
(
"Resized:"
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
console
.
log
(
"Resized:"
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
}
}
if
(
photo
.
dimensions
.
width
>
1000
||
photo
.
dimensions
.
heigth
>
1000
)
{
if
(
photo
.
dimensions
.
width
>
1000
||
photo
.
dimensions
.
heigth
>
1000
)
{
photo
.
dimensions
.
width
/=
2
;
photo
.
dimensions
.
width
/=
2
;
photo
.
dimensions
.
height
/=
2
;
photo
.
dimensions
.
height
/=
2
;
console
.
log
(
"Resized 2:"
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
console
.
log
(
"Resized 2:"
,
photo
.
dimensions
.
width
,
photo
.
dimensions
.
height
);
}
}
}
return
{
return
{
props
:
{
props
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment