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
33458a32
Commit
33458a32
authored
3 years ago
by
PLN
Committed by
PLN (Algolia)
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: solve remaining regressions
parent
526407e3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
91 additions
and
78 deletions
+91
-78
BackHome.js
components/BackHome.js
+1
-1
NavLinks.js
components/NavLinks.js
+3
-13
utils.js
lib/utils.js
+8
-9
_app.js
pages/_app.js
+26
-8
credits.js
pages/credits.js
+50
-44
index.js
pages/index.js
+1
-1
[id].js
pages/photos/[id].js
+2
-2
No files found.
components/BackHome.js
View file @
33458a32
...
@@ -13,7 +13,7 @@ function BackHome() {
...
@@ -13,7 +13,7 @@ function BackHome() {
size
=
"lg"
size
=
"lg"
cursor
=
"pointer"
cursor
=
"pointer"
>
>
<
a
>
🏠
Retour
à
la
Galerie
<
/a
>
🏠
Retour
à
la
Galerie
<
/Button
>
<
/Button
>
<
/Link
>
<
/Link
>
<
/Flex
>
<
/Flex
>
...
...
This diff is collapsed.
Click to expand it.
components/NavLinks.js
View file @
33458a32
import
Image
from
"next/image"
;
import
Image
from
"next/image"
;
import
{
import
{
Center
,
Text
,
Link
,
Button
}
from
"@chakra-ui/react"
;
Box
,
Divider
,
Center
,
Text
,
Flex
,
Spacer
,
Button
,
}
from
"@chakra-ui/react"
;
import
Head
from
"next/head"
;
import
Link
from
"next/link"
;
function
NavLinks
({
prev
,
next
})
{
function
NavLinks
({
prev
,
next
})
{
let
prevText
=
next
==
2
?
"Dernière"
:
"Précédente"
;
let
prevText
=
next
==
2
?
"Dernière"
:
"Précédente"
;
...
@@ -18,13 +8,13 @@ function NavLinks({ prev, next }) {
...
@@ -18,13 +8,13 @@ function NavLinks({ prev, next }) {
<
Center
p
=
"6"
justify
=
"space-between"
>
<
Center
p
=
"6"
justify
=
"space-between"
>
<
Link
href
=
{
"/photos/"
+
prev
}
>
<
Link
href
=
{
"/photos/"
+
prev
}
>
<
Button
<
Button
as
=
"a"
borderRadius
=
"full"
borderRadius
=
"full"
colorScheme
=
"gray"
colorScheme
=
"gray"
fontSize
=
{[
"sm"
,
"md"
,
"xl"
]}
fontSize
=
{[
"sm"
,
"md"
,
"xl"
]}
size
=
"lg"
size
=
"lg"
mx
=
{
2
}
mx
=
{
2
}
cursor
=
"pointer"
cursor
=
"pointer"
textDecoration
=
"none"
>
>
<
Text
mr
=
{
2
}
>
⟸
<
/Text
>
<
Text
mr
=
{
2
}
>
⟸
<
/Text
>
<
Text
>
{
prevText
}
<
/Text
>
<
Text
>
{
prevText
}
<
/Text
>
...
@@ -32,13 +22,13 @@ function NavLinks({ prev, next }) {
...
@@ -32,13 +22,13 @@ function NavLinks({ prev, next }) {
<
/Link
>
<
/Link
>
<
Link
href
=
{
"/photos/"
+
next
}
>
<
Link
href
=
{
"/photos/"
+
next
}
>
<
Button
<
Button
as
=
"a"
borderRadius
=
"full"
borderRadius
=
"full"
colorScheme
=
"gray"
colorScheme
=
"gray"
fontSize
=
{[
"sm"
,
"md"
,
"xl"
]}
fontSize
=
{[
"sm"
,
"md"
,
"xl"
]}
size
=
"lg"
size
=
"lg"
mx
=
{
2
}
mx
=
{
2
}
cursor
=
"pointer"
cursor
=
"pointer"
textDecoration
=
"none"
>
>
<
Text
>
{
nextText
}
<
/Text
>
<
Text
>
{
nextText
}
<
/Text
>
<
Text
ml
=
{
2
}
>
⟹
<
/Text
>
<
Text
ml
=
{
2
}
>
⟹
<
/Text
>
...
...
This diff is collapsed.
Click to expand it.
lib/utils.js
View file @
33458a32
import
path
from
"path"
;
import
path
from
"path"
;
import
fs
from
"fs"
;
import
fs
from
"fs"
;
const
sizeOf
=
require
(
'image-size'
)
const
sizeOf
=
require
(
"image-size"
);
function
getContentDirectory
(
name
)
{
function
getContentDirectory
(
name
)
{
return
path
.
join
(
process
.
cwd
(),
"public"
,
name
);
return
path
.
join
(
process
.
cwd
(),
"public"
,
name
);
...
@@ -22,13 +22,13 @@ function getAllPhotos() {
...
@@ -22,13 +22,13 @@ function getAllPhotos() {
console
.
log
(
`gACD: total pictures:
${
fileNames
.
length
}
`
);
console
.
log
(
`gACD: total pictures:
${
fileNames
.
length
}
`
);
return
fileNames
.
map
((
f
,
i
)
=>
{
return
fileNames
.
map
((
f
,
i
)
=>
{
let
id
=
i
+
1
;
// Photos are 1-indexed
let
id
=
i
+
1
;
// Photos are 1-indexed
let
photo
=
{
let
photo
=
{
id
:
id
,
id
:
id
,
path
:
photoPath
(
f
),
path
:
photoPath
(
f
),
dimensions
:
photoDimensions
(
photoPath
(
f
)),
dimensions
:
photoDimensions
(
photoPath
(
f
)),
prev
:
getPrevID
(
id
),
prev
:
getPrevID
(
id
),
next
:
getNextID
(
id
)
next
:
getNextID
(
id
)
,
};
};
console
.
log
(
`Photo
${
photo
.
id
}
->
${
photo
.
prev
}
-> X ->
${
photo
.
next
}
`
);
console
.
log
(
`Photo
${
photo
.
id
}
->
${
photo
.
prev
}
-> X ->
${
photo
.
next
}
`
);
return
photo
;
return
photo
;
...
@@ -39,26 +39,25 @@ function getPhotoById(id) {
...
@@ -39,26 +39,25 @@ function getPhotoById(id) {
const
contentDirectory
=
getContentDirectory
(
photoDir
);
const
contentDirectory
=
getContentDirectory
(
photoDir
);
const
fileNames
=
fs
.
readdirSync
(
contentDirectory
);
const
fileNames
=
fs
.
readdirSync
(
contentDirectory
);
const
path
=
photoPath
(
fileNames
[
id
-
1
]);
const
path
=
photoPath
(
fileNames
[
id
-
1
]);
return
{
id
:
id
,
return
{
id
:
id
,
path
:
path
,
path
:
path
,
dimensions
:
photoDimensions
(
path
),
dimensions
:
photoDimensions
(
path
),
prev
:
getPrevID
(
id
),
prev
:
getPrevID
(
id
),
next
:
getNextID
(
id
)
next
:
getNextID
(
id
)
,
};
// Photos are 1-indexed
};
// Photos are 1-indexed
}
}
function
getNextID
(
id
)
{
function
getNextID
(
id
)
{
const
contentDirectory
=
getContentDirectory
(
photoDir
);
const
contentDirectory
=
getContentDirectory
(
photoDir
);
const
count
=
fs
.
readdirSync
(
contentDirectory
).
length
;
const
count
=
fs
.
readdirSync
(
contentDirectory
).
length
;
return
(
id
%
count
)
+
1
;
return
(
(
count
+
id
)
%
count
)
+
1
;
}
}
function
getPrevID
(
id
)
{
function
getPrevID
(
id
)
{
const
contentDirectory
=
getContentDirectory
(
photoDir
);
const
contentDirectory
=
getContentDirectory
(
photoDir
);
const
count
=
fs
.
readdirSync
(
contentDirectory
).
length
;
const
count
=
fs
.
readdirSync
(
contentDirectory
).
length
;
return
((
id
+
count
-
2
)
%
count
)
+
1
;
return
((
id
-
1
)
%
count
)
||
count
;
}
}
export
{
getAllPhotos
,
getPhotoById
,
getNextID
,
getPrevID
};
export
{
getAllPhotos
,
getPhotoById
,
getNextID
,
getPrevID
};
This diff is collapsed.
Click to expand it.
pages/_app.js
View file @
33458a32
// pages/_app.js
// pages/_app.js
import
{
ChakraProvider
,
Divider
,
Box
,
Text
}
from
"@chakra-ui/react"
;
import
{
import
Link
from
"next/link"
;
ChakraProvider
,
Container
,
Divider
,
Box
,
Text
,
Link
,
Stack
,
}
from
"@chakra-ui/react"
;
function
MyApp
({
Component
,
pageProps
})
{
function
MyApp
({
Component
,
pageProps
})
{
return
(
return
(
<
ChakraProvider
>
<
ChakraProvider
>
<
Component
{...
pageProps
}
/
>
<
Component
{...
pageProps
}
/
>
<
Divider
/>
<
Divider
/>
<
Box
m
=
"2"
>
<
Container
as
=
{
Stack
}
maxW
=
{
"6xl"
}
py
=
{
4
}
direction
=
{{
base
:
"column"
,
md
:
"row"
}}
spacing
=
{
2
}
justify
=
"center"
align
=
{{
md
:
"center"
}}
>
<
Text
fontSize
=
"sm"
textAlign
=
"center"
>
<
Text
fontSize
=
"sm"
textAlign
=
"center"
>
Con
ç
u
par
{
" "
}
Con
ç
u
par
{
" "
}
<
Link
<
Link
href
=
"https://me.plnech.fr"
href
=
"https://me.plnech.fr"
isExternal
_hover
=
{{
textDecoration
:
"underline"
}}
_hover
=
{{
textDecoration
:
"underline"
}}
>
>
Paul
-
Louis
Nech
Paul
-
Louis
<
/Link>{" "
}
<
/Link>{" "
}
grace
aux
contenus
partag
é
s
par
les
proches
de
Philippe
-
{
" "
}
grace
aux
contenus
partag
é
s
par
les
proches
de
Philippe
.
<
Link
href
=
"/credits"
>
<
/Text
>
<
u
>
Cr
é
dits
<
/u
>
<
Text
fontSize
=
"sm"
>
<
Link
href
=
"/credits"
>
Cr
é
dits
<
/Link
>
<
/Link
>
<
/Text
>
<
/Text
>
<
/
Box
>
<
/
Container
>
<
/ChakraProvider
>
<
/ChakraProvider
>
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
pages/credits.js
View file @
33458a32
// pages/index.js
// pages/index.js
import
Head
from
"next/head"
;
import
Head
from
"next/head"
;
import
{
Box
,
Container
,
Divider
,
Text
,
Wrap
,
WrapItem
}
from
"@chakra-ui/react"
;
import
{
Box
,
Container
,
Divider
,
Text
,
Wrap
,
WrapItem
,
}
from
"@chakra-ui/react"
;
import
Image
from
"next/image"
;
import
Image
from
"next/image"
;
import
Link
from
"next/link"
;
import
Link
from
"next/link"
;
import
BackHome
from
"../components/BackHome"
;
export
async
function
getStaticProps
()
{
export
async
function
getStaticProps
()
{
let
credits
=
[
let
credits
=
[
...
@@ -15,7 +23,11 @@ export async function getStaticProps() {
...
@@ -15,7 +23,11 @@ export async function getStaticProps() {
text
:
"Pour l'hébergement de ces pages"
,
text
:
"Pour l'hébergement de ces pages"
,
link
:
"vercel.com"
,
link
:
"vercel.com"
,
},
},
{
title
:
"Next.JS"
,
text
:
"Utilisé pour construire le site"
,
link
:
"nextjs.org"
},
{
title
:
"Next.JS"
,
text
:
"Utilisé pour construire le site"
,
link
:
"nextjs.org"
,
},
];
];
return
{
return
{
props
:
{
props
:
{
...
@@ -26,56 +38,50 @@ export async function getStaticProps() {
...
@@ -26,56 +38,50 @@ export async function getStaticProps() {
export
default
function
Credits
({
credits
})
{
export
default
function
Credits
({
credits
})
{
return
(
return
(
<
div
>
<
Box
p
=
"2rem"
bg
=
"gray.200"
minH
=
"100vh"
>
<
Head
>
<
Head
>
<
title
>
Philippe
Bureau
-
Cr
é
dits
<
/title
>
<
title
>
Philippe
Bureau
-
Cr
é
dits
<
/title
>
<
link
rel
=
"icon"
href
=
"/favicon.ico"
/>
<
link
rel
=
"icon"
href
=
"/favicon.ico"
/>
<
Box
overflow
=
"hidden"
bg
=
"gray.100"
minH
=
"100vh"
>
<
/Head
>
<
Container
>
<
BackHome
mt
=
"10px"
/>
<
Container
>
<
Text
color
=
"gray.700"
fontWeight
=
"semibold"
m
=
"1rem"
textAlign
=
"center"
textDecoration
=
"underline"
fontSize
=
{[
"xl"
,
"3xl"
,
"4xl"
,
"5xl"
]}
>
Philippe
Bureau
-
Cr
é
dits
<
/Text
>
<
/Container
>
<
Wrap
px
=
"1rem"
spacing
=
{
"4px"
}
justify
=
"space-around"
>
{
credits
.
map
((
credit
)
=>
(
<
WrapItem
key
=
{
"wrap-"
+
credit
.
title
}
m
=
{
"30px"
}
bg
=
"white"
// lineHeight="0"
maxW
=
"sm"
borderWidth
=
"1px"
borderRadius
=
{
"10px"
}
>
<
Text
<
Text
color
=
"gray.700"
color
=
"gray.700"
fontWeight
=
"semibold"
fontWeight
=
"semibold"
fontSize
=
"2xl"
m
=
"1rem"
m
=
"1rem"
textAlign
=
"center"
textDecoration
=
"underline"
fontSize
=
{[
"5xl"
,
"5xl"
,
"6xl"
,
"6xl"
]}
>
>
Philippe
Bureau
-
Cr
é
dits
{
credit
.
title
}
<
/Text
>
<
/Text
>
<
/Container
>
<
br
/>
<
Wrap
px
=
"1rem"
spacing
=
{
"4px"
}
justify
=
"center"
>
<
Text
color
=
"gray.500"
fontWeight
=
"semibold"
fontSize
=
"sm"
m
=
"1rem"
>
{
credits
.
map
((
credit
)
=>
(
{
credit
.
text
}
<
WrapItem
<
/Text
>
key
=
{
"wrap-"
+
credit
.
title
}
<
/WrapItem
>
m
=
{
"30px"
}
))}
bg
=
"white"
<
/Wrap
>
lineHeight
=
"0"
<
/Box
>
maxW
=
"sm"
borderWidth
=
"1px"
borderRadius
=
{
"10px"
}
>
<
Text
color
=
"gray.700"
fontWeight
=
"semibold"
fontSize
=
"2xl"
m
=
"1rem"
>
{
credit
.
title
}
<
/Text
>
<
br
/>
<
Text
color
=
"gray.500"
fontWeight
=
"semibold"
fontSize
=
"sm"
m
=
"1rem"
>
{
credit
.
text
}
<
/Text
>
<
/WrapItem
>
))}
<
/Wrap
>
<
/Box
>
<
/Head
>
<
/div
>
);
);
}
}
This diff is collapsed.
Click to expand it.
pages/index.js
View file @
33458a32
...
@@ -71,7 +71,7 @@ export default function Home({ data, placeholders }) {
...
@@ -71,7 +71,7 @@ export default function Home({ data, placeholders }) {
quality
=
{
20
}
quality
=
{
20
}
// placeholder="blur"
// placeholder="blur"
priority
priority
//
blurDataURL={`${placeholders[photo.id]}`}
blurDataURL
=
{
`
${
placeholders
[
photo
.
id
]}
`
}
/
>
/
>
<
/Link
>
<
/Link
>
<
/WrapItem
>
<
/WrapItem
>
...
...
This diff is collapsed.
Click to expand it.
pages/photos/[id].js
View file @
33458a32
...
@@ -70,7 +70,7 @@ export default function Photos({ photo, placeholder }) {
...
@@ -70,7 +70,7 @@ export default function Photos({ photo, placeholder }) {
<
/Head
>
<
/Head
>
<
BackHome
/>
<
BackHome
/>
<
NavLinks
prev
=
{
p
ic
.
prev
}
next
=
{
pic
.
next
}
/
>
<
NavLinks
prev
=
{
p
hoto
.
prev
}
next
=
{
photo
.
next
}
/
>
<
Center
>
<
Center
>
<
Link
href
=
{
photo
.
path
}
>
<
Link
href
=
{
photo
.
path
}
>
...
@@ -89,7 +89,7 @@ export default function Photos({ photo, placeholder }) {
...
@@ -89,7 +89,7 @@ export default function Photos({ photo, placeholder }) {
<
/Center
>
<
/Center
>
<
Divider
my
=
"1rem"
/>
<
Divider
my
=
"1rem"
/>
<
NavLinks
prev
=
{
p
ic
.
prev
}
next
=
{
pic
.
next
}
/
>
<
NavLinks
prev
=
{
p
hoto
.
prev
}
next
=
{
photo
.
next
}
/
>
<
/Box
>
<
/Box
>
);
);
}
}
This diff is collapsed.
Click to expand it.
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