mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
4466ba436b
## Description This PR ensures that the default prettier config is used for examples and templates. This config is compatible with `prettier@3` as well (upgrading prettier is bigger change that can be a future PR). ## Changes - Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will be needed upgrading to prettier@3) - Added `examples/.prettierrc.json` with default config (this will change every example) - Added `packages/create-next-app/templates/.prettierrc.json` with default config (this will change every template) ## Related - Fixes #54402 - Closes #54409
67 lines
1.4 KiB
JavaScript
67 lines
1.4 KiB
JavaScript
import * as React from "react";
|
|
import Link from "next/link";
|
|
|
|
import { motion } from "framer-motion";
|
|
import { images } from "../constants";
|
|
|
|
const transition = {
|
|
duration: 1,
|
|
ease: [0.43, 0.13, 0.23, 0.96],
|
|
};
|
|
|
|
const imageVariants = {
|
|
exit: { y: "50%", opacity: 0, transition },
|
|
enter: {
|
|
y: "0%",
|
|
opacity: 1,
|
|
transition,
|
|
},
|
|
};
|
|
|
|
const backVariants = {
|
|
exit: { x: 100, opacity: 0, transition },
|
|
enter: { x: 0, opacity: 1, transition: { delay: 1, ...transition } },
|
|
};
|
|
|
|
const SingleImage = ({ index }) => (
|
|
<>
|
|
<motion.div className="single" initial="exit" animate="enter" exit="exit">
|
|
<motion.img
|
|
variants={imageVariants}
|
|
src={`https://images.unsplash.com/${images[index]}?auto=format&fit=crop&w=1500`}
|
|
alt="The Barbican"
|
|
/>
|
|
<motion.div className="back" variants={backVariants}>
|
|
<Link href="/">← Back</Link>
|
|
</motion.div>
|
|
</motion.div>
|
|
<style>
|
|
{`
|
|
.single {
|
|
overflow: hidden;
|
|
height: 100vh;
|
|
}
|
|
|
|
.single img {
|
|
max-width: 100%;
|
|
max-height: 100vh;
|
|
}
|
|
|
|
.back {
|
|
position: fixed;
|
|
top: 50px;
|
|
right: 50px;
|
|
font-size: 54px;
|
|
z-index: 1;
|
|
}
|
|
|
|
.back a {
|
|
text-decoration: none;
|
|
}
|
|
`}
|
|
</style>
|
|
</>
|
|
);
|
|
|
|
export default SingleImage;
|