-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
87 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { FullPageImageView } from "~/common/full-page-image-view" | ||
import { FullscreenView } from "~/views/fullscreen-view" | ||
|
||
export default function PhotoModal({ | ||
params: { id: photoId }, | ||
}: { | ||
params: { id: string } | ||
}) { | ||
return ( | ||
<div className="flex size-full min-h-0 min-w-0 overflow-y-hidden"> | ||
<FullPageImageView photoId={photoId} /> | ||
<div className="flex min-h-0 min-w-0 overflow-y-hidden"> | ||
<FullscreenView photoId={photoId} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use client" | ||
|
||
import { useRouter } from "next/navigation" | ||
|
||
import { Icons } from "./icons" | ||
import { Button } from "./ui/button" | ||
|
||
export function BackButton() { | ||
const router = useRouter() | ||
return ( | ||
<div className="absolute left-0 top-0 p-2"> | ||
<Button | ||
onClick={() => router.back()} | ||
size="icon" | ||
variant="outline" | ||
className="dark rounded-full" | ||
> | ||
<Icons.back className="size-4 text-white md:size-6" /> | ||
</Button> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import Image from "next/image" | ||
|
||
import { BackButton } from "~/components/back-button" | ||
import { DeleteButton } from "~/components/delete-button" | ||
import { FullscreenButton } from "~/components/fullscreen-button" | ||
import { getImage } from "~/server/queries" | ||
|
||
export async function FullscreenView(props: { photoId: string }) { | ||
// convert the id string to a number | ||
const idAsNumber = Number(props.photoId) | ||
if (Number.isNaN(idAsNumber)) throw new Error("Invalid photo id") | ||
|
||
const image = await getImage(idAsNumber) | ||
|
||
return ( | ||
<div className="relative z-50 flex aspect-[8/5] w-full max-w-full items-center p-4 wide:h-full xl:taller-than-854:h-auto"> | ||
{/* Main image */} | ||
<div className="w-full overflow-hidden"> | ||
<div className="relative flex items-center justify-center"> | ||
<Image | ||
src={image.url} | ||
width={1920} | ||
height={1200} | ||
priority | ||
alt="Next.js Conf image" | ||
/> | ||
<OverlayMenu photoId={props.photoId} /> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
async function OverlayMenu(props: { photoId: string }) { | ||
const idAsNumber = Number(props.photoId) | ||
if (Number.isNaN(idAsNumber)) throw new Error("Invalid photo id") | ||
|
||
const image = await getImage(idAsNumber) | ||
|
||
return ( | ||
<> | ||
<FullscreenButton photoId={image.id} /> | ||
<DeleteButton photoId={image.id} /> | ||
<BackButton /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters