Commit ce5718b2 by PLN Committed by PLN (Algolia)

feat: NavLinks, adapt quality on home

parent ef5c3390
import Image from "next/image";
import {
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 }) {
let prevText = next == 2 ? "Dernière" : "Précédente";
let nextText = next != 1 ? "Suivante" : "Retour au début";
return (
<Center p="6" justify="space-between">
<a href={"/photos/" + prev}>
<Button
as="a"
borderRadius="full"
colorScheme="gray"
fontSize="xl"
size="lg"
mx={2}
cursor="pointer"
>
<Text mr={2}></Text>
<Text>{prevText}</Text>
</Button>
</a>
<a href={"/photos/" + next}>
<Button
as="a"
borderRadius="full"
colorScheme="gray"
fontSize="xl"
size="lg"
mx={2}
cursor="pointer"
>
<Text>{nextText}</Text>
<Text ml={2}></Text>
</Button>
</a>
</Center>
);
}
export default NavLinks;
...@@ -13,6 +13,7 @@ import Image from "next/image"; ...@@ -13,6 +13,7 @@ import Image from "next/image";
import Head from "next/head"; import Head from "next/head";
import BackHome from "../../components/BackHome"; import BackHome from "../../components/BackHome";
// import { getPlaiceholder } from "plaiceholder"; // import { getPlaiceholder } from "plaiceholder";
import NavLinks from "../../components/NavLinks";
export async function getStaticPaths() { export async function getStaticPaths() {
const photos = await getAllPhotos(); const photos = await getAllPhotos();
...@@ -69,10 +70,10 @@ export default function Photos({ photo, placeholder }) { ...@@ -69,10 +70,10 @@ export default function Photos({ photo, placeholder }) {
</Head> </Head>
<BackHome /> <BackHome />
<Divider my="1rem" /> <NavLinks prev={pic.prev} next={pic.next} />
<Center> <Center>
<a href={photo.path}> <Link href={photo.path}>
<Image <Image
src={photo.path} src={photo.path}
width={photo.dimensions.width || 480} width={photo.dimensions.width || 480}
...@@ -84,43 +85,11 @@ export default function Photos({ photo, placeholder }) { ...@@ -84,43 +85,11 @@ export default function Photos({ photo, placeholder }) {
blurDataURL={placeholder} blurDataURL={placeholder}
loading="eager" loading="eager"
/> />
</a> </Link>
</Center> </Center>
<Divider my="1rem" />
<Center> <Divider my="1rem" />
<Box p="6"> <NavLinks prev={pic.prev} next={pic.next} />
<Link href={"/photos/" + photo.prev}>
<Button
as="a"
borderRadius="full"
colorScheme="gray"
fontSize={["sm", "md", "lg", "lg"]}
size={["sm", "md", "lg", "lg"]}
cursor="pointer"
m="15px"
>
Précédente
</Button>
</Link>
<Link href={"/photos/" + photo.prev}>
<Button
as="a"
borderRadius="full"
colorScheme="gray"
fontSize={["sm", "md", "lg", "lg"]}
size={["sm", "md", "lg", "lg"]}
cursor="pointer"
m="15px"
>
<p m="1">
{photo.next != 1 ? "Suivante " : "Retour au début "}
</p>
<p></p>
</Button>
</Link>
</Box>
</Center>
</Box> </Box>
); );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment